I'm working on a project to remotely start 2 pumps when sending a message to the MKR.
Now I have a Nano at each pump and using them as 'slaves'.
The MKR is the master which is sending the commands to the Nanos. I've bought HC12 for RF communication but I can't get it to work.
I understand that I cannot use the SofwareSerial library in the MKR.
Is there any way to communicate with the HC12 module from and to the Nano's and the MKR GSM 1400?
the MKR series has a hardware serial port on pins 13 Rx and 14Tx
this is a program I used to test a MKRFOX serial communications
// Arduino MKRFOX hardware serial1 test
// NOTE: MKRFOX uses 3.3V logic
// - if commected to UNO 5V logic use a voltage divider 2.2K to ground 1K to UNO Tx
// MKRFOX pin 14 is TX
// MKRFOX pin 13 is Rx
// for loopback test connect pin 13 to pin 14
void setup() {
Serial.begin(115200); // initialise serial monitor port
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial1.begin(9600); // initialise Serial1
Serial.println();
Serial.write("Arduino MKRFOX Serial1 test - for loopback test connect pin 13 to pin 14\n");
}
void loop() {
if (Serial1.available()) // read from Serial1 output to Serial
Serial.write(Serial1.read());
if (Serial.available()) { // read from Serial outut to Serial1
int inByte = Serial.read();
//Serial.write(inByte); // local echo if required
Serial1.write(inByte);
}
}
note that the Nano uses 5V logic the MKR is 3.3V - use a potential divider on the Nano Tx to MKR Rx