You are reading a single comment by @PeterD and its replies. Click here to read the full conversation.
  • Hi,

    I've tried to write a program for the Espruino.
    I'm new to Espruino and Java, so it is possible that I'm asking stupid questions ;)

    I have a Espruino Classic with a ILI9341 connected.
    If I run the program while the PC is connected to the board, It works fine.
    But when I change (In communications - Save on Send) Direct To Flash, the preset variable "HomeScore" shows "2" on the display, and when pressing the BTN, It goes up with 2 counts or sometimes 3 counts.

    Is this a known error, or do I something wrong?

    Regards,
    Peter

    B2.set(); // light on
     var HomeScore = 0;
    
    SPI1.setup({sck:B3, miso:B4, mosi:B5, baud: 1000000});
    var g = require("ILI9341").connect(SPI1, B6, B8, B7, function() {
      
      g.clear();
      g.setRotation(3);
      
      g.setFontVector(30);
      g.setColor(0,255,0);
      g.drawString("Home",5,50);
      g.setFontVector(45);
      g.setColor(255,255,255);
      g.drawString(HomeScore,40,85);
      
    });
    
    var LocHome = 0;
    function HomeUp() {
      g.setColor(0,0,0);
      g.setFontVector(45);
      g.drawString(HomeScore,25+LocHome,85);
      if (HomeScore<10) LocHome=15;
      if (HomeScore>8) LocHome=0;
      HomeScore = (HomeScore+1);
      g.setColor(255,255,255);
      g.drawString(HomeScore,25+LocHome,85);
    }
    
    setWatch(HomeUp, BTN, {repeat: true, edge:'falling'});
    
About

Avatar for PeterD @PeterD started