Firmata & REALbasic
hi,
i'm new arduino , use sensor platform relay data host computer... send instructions. i'm using realbasic on mac , can control led on pin 13 long sketch knows listen for. rather create communications protocol, read firmata , thought perfect. however, life of me, can't figure out messaging syntax. wondering if post 2 commands should send on serial port set pin mode , activate led... , should enough me decipher rest.
for example, i'm sending "f4 0d 01" set pin 13 output. right? think second command should begin "9d" (turn on pin 13) don't have clue lsb , msb bytes should be.
any appreciated. know, i'm off in left field.
i'm new arduino , use sensor platform relay data host computer... send instructions. i'm using realbasic on mac , can control led on pin 13 long sketch knows listen for. rather create communications protocol, read firmata , thought perfect. however, life of me, can't figure out messaging syntax. wondering if post 2 commands should send on serial port set pin mode , activate led... , should enough me decipher rest.
for example, i'm sending "f4 0d 01" set pin 13 output. right? think second command should begin "9d" (turn on pin 13) don't have clue lsb , msb bytes should be.
any appreciated. know, i'm off in left field.
hi johnrd,
you correct. set pin 13 output send 3 bytes - hex values f4 0d 01. set values or states (on/off) of digital pins address entire port @ once. on duemilanove board ports (as firmata sees them) set follows:
port 0 - pins 2,3,4,5,6,7
port 1 - pins 8,9,10,11,12,13
you turn these digital pins on/off sending 3 byte message in following format:
port | 1st byte | 2nd byte
where port 0x90 port 0, 0x91 port 1 ... (and that's need duemilanove has many digital pins)
the 1st , 2nd bytes 'bitmasks' port in question. think of bits in 1st , 2nd byte individual switches pins in port.
so send message turn on pin 13 send:
the second row in table shows hex values. in third row i've shown bits in each byte. pin 13 6th pin in port 1 turn on set 6th bit '1'.
each time send digital i/o message setting state of pins in port. in example above, when turned on pin 13 message did turn on pin 13 turned off other pins (all other bits set '0').
to use digital i/o messages have keep track of pins on or off in software. if pin 10 on , decide turn on pin 13 , use message above you'd turning pin 13 on 'accidentally' turning off pin 10.
below bits correspond each pin on board:
port 0 (pins 2,3,4,5,6,7)
1st byte 2nd byte
x x 13 12 11 10 9 8 x x x x x x x x
port 1 (pins 8,9,10,11,12,13)
1st byte 2nd byte
x x 6 5 4 3 2 x x x x x x x x 7
in port 1 pins 0 , 1 rx , tx aren't used. wherever see x above should simple send 0 (zero).
so... let's want turn on pins 13, 11 , 8 you'd send:
0x91 followed following 2 bytes of 'bitmasks' - 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0
in hex that'd 0x91 0x29 0x00.
if want turn off pin 11 you'd have send 0x91 followed 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0
which sets bit pin 11 0 leaves bits pin 13 , 8 set 1
i hope of , made sense.
happy bitmasking,
andrew
you correct. set pin 13 output send 3 bytes - hex values f4 0d 01. set values or states (on/off) of digital pins address entire port @ once. on duemilanove board ports (as firmata sees them) set follows:
port 0 - pins 2,3,4,5,6,7
port 1 - pins 8,9,10,11,12,13
you turn these digital pins on/off sending 3 byte message in following format:
port | 1st byte | 2nd byte
where port 0x90 port 0, 0x91 port 1 ... (and that's need duemilanove has many digital pins)
the 1st , 2nd bytes 'bitmasks' port in question. think of bits in 1st , 2nd byte individual switches pins in port.
so send message turn on pin 13 send:
| message | port | 1st byte | 2nd byte |
| hex version of message | 0x91 | 0x20 | 0x00 |
| hex , byte bits version | 0x91 | 00100000 | 00000000 |
the second row in table shows hex values. in third row i've shown bits in each byte. pin 13 6th pin in port 1 turn on set 6th bit '1'.
each time send digital i/o message setting state of pins in port. in example above, when turned on pin 13 message did turn on pin 13 turned off other pins (all other bits set '0').
to use digital i/o messages have keep track of pins on or off in software. if pin 10 on , decide turn on pin 13 , use message above you'd turning pin 13 on 'accidentally' turning off pin 10.
below bits correspond each pin on board:
port 0 (pins 2,3,4,5,6,7)
1st byte 2nd byte
x x 13 12 11 10 9 8 x x x x x x x x
port 1 (pins 8,9,10,11,12,13)
1st byte 2nd byte
x x 6 5 4 3 2 x x x x x x x x 7
in port 1 pins 0 , 1 rx , tx aren't used. wherever see x above should simple send 0 (zero).
so... let's want turn on pins 13, 11 , 8 you'd send:
0x91 followed following 2 bytes of 'bitmasks' - 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0
in hex that'd 0x91 0x29 0x00.
if want turn off pin 11 you'd have send 0x91 followed 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0
which sets bit pin 11 0 leaves bits pin 13 , 8 set 1
i hope of , made sense.
happy bitmasking,
andrew
Arduino Forum > Forum 2005-2010 (read only) > Software > Interfacing > Firmata & REALbasic
arduino
Comments
Post a Comment