Go Down

Topic: about receiving 2 integer numbers at a time (Read 95 times) previous topic - next topic

Suyash_Suvare

i want to send two integer values at a time from master to slave while using I2C communication.
i am sending 'revo' & 'count' from master to slave.
i have used:

  Wire.beginTransmission(0x40);
  Wire.write(count);
  Wire.endTransmission();
  delay(500);

  Wire.beginTransmission(0x40);
  Wire.write(revo);
  Wire.endTransmission();
  delay(500);

 this code:

but i m receiving both numbers assign to single variable.
i actual i need revo as a variable and count as a another variable.
so what can  do for that??
please help.

UKHeliBob

You could receive the first one, copy it to another variable then receive the second one, but how will you know which is which ?

You would be better sending an array of two ints

Code: [Select]
Wire.write(theArray, numberOfBytesToSend)
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up