I tried developing this receiver code which initially outputs data for like the first two values and then just outputs zero:
//Receiver Code
char str[4];
void setup() {
Serial.begin(9600);
}
void loop() {
int i;
Serial.readBytes(str,4);
i= atoi(str);
Serial.println(i);
delay(500);
}
I also tried printing the character directly but this resulted in weird characters being displayed in the serial monitor:
//Receiver Code
char str[4];
void setup() {
Serial.begin(9600);
}
void loop() {
int i;
Serial.readBytes(str,4);
Serial.println(str);
delay(500);
}