I'm trying to transmit random number and display to lcd using I2C
this is the master:
if(strstr(message, "A"))
{
long randNumber;
randNumber = random(11111,99999);
Wire.beginTransmission(5);
Wire.write(randNumber);
Wire.endTransmission();
}
here's the slave which will display the generate random number.
void receiveEvent(int howMany)
{
char i;
while(Wire.available() > 0)
{
numbers[i] = Wire.read();
i++;
}
lcd.print(numbers);
}
but it would only display unread characters or it gives error.