Dear all,
Transmitter code :
void setup(){
Serial.begin(9600);
}
void loop(){
{
if (digitalRead(8)==LOW)
{
Serial.write(1);
}
}
}
Receiver code:
void setup()
{
Serial.begin(9600);
}
void loop()
{
int incoming;
if (Serial.available()) {
delay(1);
while (Serial.available() > 0){
incoming=Serial.read();
if(incoming==1)
{
Serial.print(incoming);
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13,LOW);
delay(100);
}
}
}
}
I realised that when I press the button, it will not just send 'a' 1, but instead it shows like around 20++ 1 in the serial monitor.
Why ? I thought only will serialprint only one 1 ? Instead of so many ?
Thanks