Using I2C to connect Arduinos
i've been working nicholas zambetti's examples i2c master/slave.
i can communicate between 2 arduinos in both directions.
from master arduino, can send multiple bytes slave.
however, can not seem slave send more 1 byte master.
(i can, slave send string of characters master.)
for example, slave code send 1 byte master fine:
this sends string master fine:
but seems can't . . .
am allowed 1 wire.send @ slave when responding request?
or doing wrong?
it seems odd can send string, limited single byte otherwise.
if that's how is, can live - need know.
in general these great examples , seem way go inter-arduino communications. zambetti did great job writing twi , wiring code.
any appreciated. can't seem find on how use wire library in general.
[edit]oops! rtfm! i'm sure answer here:
http://arduino.cc/en/reference/wiresend (quantity param)
sorry flack.
[/edit]
i can communicate between 2 arduinos in both directions.
from master arduino, can send multiple bytes slave.
however, can not seem slave send more 1 byte master.
(i can, slave send string of characters master.)
for example, slave code send 1 byte master fine:
code: [select]
void requestevent(){
wire.send(bvar);
}this sends string master fine:
code: [select]
void requestevent(){
wire.send("hello ");
}but seems can't . . .
code: [select]
void requestevent(){
wire.send(bvar);
wire.send(bvar2);
}am allowed 1 wire.send @ slave when responding request?
or doing wrong?
it seems odd can send string, limited single byte otherwise.
if that's how is, can live - need know.
in general these great examples , seem way go inter-arduino communications. zambetti did great job writing twi , wiring code.
any appreciated. can't seem find on how use wire library in general.
[edit]oops! rtfm! i'm sure answer here:
http://arduino.cc/en/reference/wiresend (quantity param)
sorry flack.

[/edit]
i want able send command slave, wait slave complete command (sometimes 2-3 sec.) , receive response slave command completed.
my question is:
when master makes wire.requestfrom data slave, how long wait response ?
(by checking wire.available() )
btw - in regard previous post, assume you're limited 1 wire.send response request @ slave. (however can send strings , arrays.) if can confirm that, great.
my question is:
when master makes wire.requestfrom data slave, how long wait response ?
(by checking wire.available() )
btw - in regard previous post, assume you're limited 1 wire.send response request @ slave. (however can send strings , arrays.) if can confirm that, great.
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Using I2C to connect Arduinos
arduino
Comments
Post a Comment