I have a project that I am using a 4x4 keypad to perform a function that drives 16 servos from one position to the other. It works ok. I want to introduce a remote keypad which I have built with a Mini Pro serial writing the key pressed to a HC-12. This works fine. If I use the following testcode in an UNO with the 2nd HC-12 connected to the RX0 input I can see the keypresses from the remote keypad perfectly, however if I load the code into a MEGA I get nothing, I am using RX0 on the MEGA, Am I missing something?
int incomingByte = 0; // for incoming serial data
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}