• Hi,

    So I connected a Pico to an Original Espruino and tried to monitor the Original Espruino from the Pico.
    So far, I ended up with results only for busy indicator as I am running the original espruino board from USB connection so there is no deep sleep available yet.

    The code on the Originla Espruino just includes

      setBusyIndicator(LED1); // A13
      setSleepIndicator(LED2);  // A14
    

    The code on the Pico is

    /*
                  Measure time spent on LED1/LED2 by an original Espuino board
                  */
    
    var onPin=B10; // Non deep sleep (1===running or simple sleep) led from Original Espruino Board
    var onTime=0;
    var busyPin=B13; // Busy (1=== running, neither simple sleep, nor deep sleep) led from Original Espruino Board
    var busyTime=0;
    var deepSleepTime=0;
    var startedAt=getTime();
    
    function log() {
      let runningFor=getTime()-startedAt;
      console.log("Running for",runningFor,"s");
      console.log("On time (Busy + Sleep)",onTime,"s",Math.floor(onTime*100­0/runningFor)/10,"%\tbusyTime (Busy)",busyTime,"s",Math.floor(busyTime­*1000/runningFor)/10,"%\tdeepSleepTime",­deepSleepTime,"s",Math.floor(deepSleepTi­me*1000/runningFor)/10,"%");
    }
    
    function resetChronos() {
      onPin=B10;
      onTime=0;
      OLED2=B13;
      busyTime=0;
      deepSleepTime=0;
      startedAt=getTime();
    }
    
    function onInit() {
      resetChronos();
      log();
    }
    
    var idOnTimeWatch=setWatch(function (e) {
      onTime+=e.time-e.lastTime;
    }, onPin, { repeat:true, edge:'falling' });
    
    var idBusyTimeWatch=setWatch(function (e) {
      busyTime+=e.time-e.lastTime;
      log();
    }, busyPin, { repeat:true, edge:'falling' });
    
    var idDeepSleepTimeWatch=setWatch(function (e) {
      deepSleepTime+=e.time-e.lastTime;
      log();
    }, onPin, { repeat:true, edge:'rising' });
    
    
    
About

Avatar for asez73 @asez73 started