We are currently using the below code with no success. The slaves are connected through a USB connector so do we need a 4.7k pull-up resistor on each slave or just once? (Currently we have one)
//Master
E.setBootCode("function cmdOnSlave(slave, cmd) {
Serial1.println('if(ID==\"' + slave + '\")' + cmd + ';');
}
USB.setConsole(true); // make sure console stays off Serial1
var line = '';
Serial1.on('data', function(d) {
line += d;
i = line.indexOf('\n');
while (i >= 0) {
console.log(line.substr(0, i)); // do stuff with data
line = line.substr(i + 1);
i = line.indexOf('\n');
}
});
", true)
//Slave
E.setBootCode("
var ID = getSerial();
pinMode(B6, 'af_opendrain');
echo(0);
", true);
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
We are currently using the below code with no success. The slaves are connected through a USB connector so do we need a 4.7k pull-up resistor on each slave or just once? (Currently we have one)