• I had a switchto switch on/off setConsole on USB or on an other Serial
    I use print non console.log

    i've tried this

    let laser;
    
    function lis(){
      let somme=0;
      var dist = laser.performSingleMeasurement().distance;
      print(dist);
      //console.log(dist);
      //console.log("distance: ",dist," lissée:",somme/table.length);
      analogWrite(LED1, (1000-dist)/1000, { soft:true, freq:200 });
    }
    
    function onInit() {
      //Serial1.setup(115200);
      I2C2.setup({sda:B3,scl:B10});
      laser = require("VL53L1X").connect(I2C2);
      print("init");
      digitalWrite(B4,1); // set XSDN -> turn the sensor on
      setInterval(lis, 150);
      pinMode(A6, 'input_pulldown');
      setWatch( function (e) {
        console.log(e.state);
        if (e.state) {
          Serial1.setConsole();
        } else {
          USB.setConsole(true);
        }
      }, A6, { repeat:true, edge:"both", debounce: 100 });  
    }
    

    if i move the console to another Serial...
    nothing come in Processing
    otherwise my output is always crippy

    
    >
    1587
    
    

    1587 is my number

    :v

    Any idea

About

Avatar for Mrbbp @Mrbbp started