• hi, I play now a couple hours with save and onInit function and can't run my program when my pico is starting after reset (unplug from usb), is there any simple explanation?
    here is the code

    
    
    function oled(){
     
             g.clear();
             g.setFontVector(28);
             g.drawString("FIRST",0,12);  
             g.flip();
      
      setTimeout(function(){
        nextOne();
        setTimeout(function(){clear();},3000);
        setTimeout(function(){setInterval(data,1­000);},3200);
      },2000); 
    }
    
    function nextOne(){
        g.clear();
        g.drawString("NEXT",0,12);
        g.flip();
    }
    
    function clear(){ g.clear();g.flip(); }
    
    function data() {
      var bat = analogRead(A5);
      g.clear();
      g.drawString(bat.toFixed(2) + "v",0,0);
      g.flip();
    }
    
    function onInit(){
    setTimeout(function(){
      oled();
      },2000); 
     // onInit();
    }
    
    onInit();
    
    I2C2.setup({scl:B10,sda:B3});
    var g = require("SSD1306").connect(I2C2);
      
    E.on('init', function() { onInit();  });
    
About

Avatar for bigplik @bigplik started