Does anyone know an easier way to send a packet of hex data out the serial port. Here is what works for me
var dio6Hi = [0x7E, 0x00, 0x10, 0x17, 0x01, 0x00, 0x13, 0xA2, 0x00, 0x40, 0xC0, 0xA9, 0x99, 0xFF, 0xFE, 0x02, 0x44, 0x36, 0x05, 0x72 ];
b.serialWrite(port, [
dio6Hi[0] ,dio6Hi[1] ,dio6Hi[2] ,dio6Hi[3] ,dio6Hi[4] ,dio6Hi[5] ,dio6Hi[6] ,dio6Hi[7] ,dio6Hi[8] ,dio6Hi[9],
dio6Hi[10],dio6Hi[11],dio6Hi[12],dio6Hi[13],dio6Hi[14],dio6Hi[15],dio6Hi[16],dio6Hi[17],dio6Hi[18],dio6Hi[19] ]);
This will write all of the data in variable dio6Hi out of the UART in order that I want. But I would like to do this or something like it:
for (var i = 0; i < dio6Hi.length; i++) {
b.serialWrite(port, [dio6Hi[i]] );
}
or even this:
b.serialWrite(port, [dio6Hi[0]] );
b.serialWrite(port, [dio6Hi[1]] );
b.serialWrite(port, [dio6Hi[2]] );
.
.
.
b.serialWrite(port, [dio6Hi[18]] );
b.serialWrite(port, [dio6Hi[19]] );
Either of these do not work they only send out the first byte in dio[0] and then stop. Is there any way with the serialWrite function to index the variable with a “for” or other command in order to simplify sending out an array of numbers?