• Sorry, just now, I updated the espruino code to the latest one.
    It is working perfectly. This is my test code :

    var status=0;
    function swap() {
        status = !status;
        digitalWrite(D2, status);
    }
    
    var Serial3 = new Serial();
    Serial3.setup(9600, {rx:D4,tx:D5});
    //Serial1.setup(9600);
    Serial3.on('data', function (data) { 
      console.log(data);
      swap(); 
    });
    
    var buf1 = new ArrayBuffer();
    buf1 = [0x01, 0x03, 0x00, 0x00, 0x00, 0x05, 0x85, 0xC9];
    var count = 0;
    setInterval(function() {
      if (count > 7) {
        count = 0;
      }
      console.log("send data", count);
      Serial3.write(buf1);
      count += 1;
    }, 2000);
    

    However, if we increase the baud-rate to 115200, the ESP will be crashed.
    But, for my application, it is Ok. For displaying the data to the LED matrix display, that required highspeed UART at 115200, I will use hardware serial.

    Thanks for your help, @MaBe

About

Avatar for maman @maman started