Hi!
I tried it with connecting RX and TX with a jumper cable.
LED is blinking when it receives data.
int send = 5;
int income = 0;
int led = 12;
void setup() {
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop(){
// transmitter
Serial.print("I sent: ");
Serial.println(send, DEC);
// reciever
if (Serial.available()) {
digitalWrite(led, HIGH); // sets the LED on
delay(1000); // waits for a second
digitalWrite(led, LOW); // sets the LED off
delay(1000);
income = Serial.read();
Serial.print("I received: ");
Serial.println(income, DEC);
}
delay(2000);
}
But the output is quiet strange:
I sent: 5
I received: 32
I sent: 5
I received: 115
I sent: 5
I received: 101
I sent: 5
I received: 110
The value of "I received" should be 5, I assume!?
Thanks for help!!