• yes, I found it myself Gordon ;) just wanted to post I found solution ;)
    my code looks now that, and is working now ;)

    
    
    function OLED(){
    clearWatch();
    
    I2C1.setup({scl:B6,sda:B7});
    var g = require("SSD1306").connect(I2C1);
    g.clear();
      g.flip();
    
    pinMode(B15, 'input_pulldown');
    
    //Button tests
    var BTN22 = B15;
    var screen = 0;
    var battery; // = analogRead(A5)*2*3.3;
    var analogSample;
    
    function screens(){
      g.clear();
      g.setFontVector(15);
      g.drawString("one",25,20);
      g.flip();
    }
    
    function screens2(){
      analogSample = analogRead(A2);
     g.clear();
     g.setFontVector(15);
     g.drawString("OLED OFF?");
     g.setFontVector(10);
     g.drawString(analogSample,60,50);
     g.flip();
    }
    
    function screens3(){
      battery = analogRead(A5);
     g.clear();
     g.setFontVector(20);
     g.drawString("" + battery.toFixed(2),20,20);
     g.flip();
    }
    
    
    setWatch(function(e) {
        screen++;
        console.log(screen);
        clearInterval();
        if(screen === 0) screens();
      if(screen === 1) setInterval(screens2,200);
      if(screen === 2) setInterval(screens3,500);
      if(screen >= 2) screen = 0;
    
      
    },BTN22, {repeat: true, edge: 'rising', debounce:150});
    
    }
               
    OLED();
    
    
    
About

Avatar for bigplik @bigplik started