Hi everyone, this is my first post on these forums so apologies for any rules that I may have missed in regards to post formats etc.
I am a complete beginner to the Arduino world and have been researching as much as I can, however on my personal project I have hit a wall. please help..
This is the Master Mega 2560;
Wire.beginTransmission(1);
Wire.write("H");
Wire.endTransmission();
This is the Slave 1 Mega 2560;
void receiveEvent(int howMany)
{
char inChar;
while (Wire.available() > 0)
{
inChar = Wire.read();
if (inChar == 'H' )
{
digitalWrite(13, HIGH);
}
else if (inChar == 'L')
{ digitalWrite(13, LOW);
}
}
}
If I Wire.write ("H") the led on the slave turns on as expected;
However I'm looking to find out how to send and receive multiple characters,
for example;
MASTER || Wire.write ("HHH");
SLAVE 1 || if (inChar == ('HHH') ) //I seem to be having trouble getting the code to read HHH
Kind regards
Philip