• Yes - neither I2C or SPI slave is implemented because you need to have very fast, guaranteed response times to do it properly (which is almost impossible with JS).

    However, Serial is a really good option. Set the TX pin of each slave to pinMode(TX, 'af_opendrain'), then connect all the boards together and have a pullup resistor on the slave TX (master RX) line.

    You can make your own addressing system, but actually it is possible to use Espruino's built-in console. For instance:

    • Connect all slave B6 together, with a 4.7k pullup resistor to 3.3v, and to the master B7
    • Connect all slave B7 together, to master B6

    Slaves

    pinMode(B6, 'af_opendrain');
    var ID = "slave1"; // or whatever
    
    function myFunction() {
    }
    function onInit() {
      echo(0);
    }
    

    Master

    function cmdOnSlave(slave, cmd) {
      Serial1.println("if(ID=='"+slave+"')"+cm­d+";");
    }
    
    cmdOnSlave("slave1", "myFunction(1,2,3)");
    cmdOnSlave("slave2", "digitalWrite(LED1,1)");
    
About

Avatar for Gordon @Gordon started