• I am new to Espruino and have just had a lot of difficulty with this. For that reason I am posting my solution for future reference. Sorry to raise the dead.

    The following code allows me to toggle LED1 via echo 'a' > /dev/tty.usbmodem1411. I am not sure if the tty would be different for another user(?)

    var state = false;
    LED1.write(state);
    
    Serial1.setup(9600);
    Serial1.setConsole();
    Serial1.on('data', function (data) {
      state = !state;
      LED1.write(state);
    });
    
About

Avatar for user53899 @user53899 started