-
@Gordon I plan to write binary data using the Uint16Array object. The master will send this to one slave, and the slave will respond back with a Uint16Array object. Total bytes in each direction will be < 100 bytes.
Since I want to control the send and receive, I'm thinking of using Serial.write(data), then Serial.read() to receive the response from the slave. But Serial.read() appears to be a blocking call (no callback). So I'm not sure if my idea is the right approach. Thoughts?
For the I2C slave, you could take a look at
setWatch
'sdata
pin option (so you setWatch SCL and use SDA for data) - although things may still be a bit tricky to get it working nicely.What I always suggest for things like this is just to use Serial communications with the UART. This generally works really nicely:
opendrain
Create some kind of software system to ensure that the slaves only write data when they're asked to by the master. The simplest is just to use the built-in JS REPL to execute code that does some kind of
if (id=myId) doSomething()
type thing: