How do I send arduino a firmata command to turn on a pin -
How do I send arduino a firmata command to turn on a pin -
i'm trying implement firmata protocol , having bit of hard time deciphering spec writing digital pins:
i have noted next parts of spec of firmata 2.3
* type command channel first byte sec byte ------------------------------------------------------------------------------ * digital i/o message 0x90 port lsb(bits 0-6) msb(bits 7-13)
and
/* 2 byte digital info format, sec nibble of byte 0 gives port number (e.g. 0x92 3rd port, port 2) * 0 digital data, 0x90-0x9f, (midi noteon, different info format) * 1 digital pins 0-6 bitmask * 2 digital pin 7 bitmask */
i'm having difficulty interpreting spec. i've looked @ other implementations, haven't been able see relationship between spec , implementation.
so let's wanting turn on arduino led (pin 13), know on sec port, port 1, first byte #{91}
.
i'm getting confused bitmask sec 2 bytes though. know bitmask is, want enable right bit pin.
why bitmask big digital pins? i'm familiar using bitmasks on digital outputs of plcs, seems much different (one pin, 1 bit)
my thought pin 13 7th pin on port 1. since don't care other pins, mark pin in 2nd byte #{40} , don't need pins set 3rd byte #{00}?
i don't think interpretation of bitmasks correct, , it's error is
am on right track this? right command setting pin high or low?
after strace
debugging firmata test application, discovered simple command turn on pin 13 was:
#{912000}
and turn off:
#{910000}
arduino firmata
Comments
Post a Comment