Skip to content

Instantly share code, notes, and snippets.

@Jswoon
Created September 8, 2016 07:17
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save Jswoon/24d9d9a72c0111360227978ab21fb6d5 to your computer and use it in GitHub Desktop.
Save Jswoon/24d9d9a72c0111360227978ab21fb6d5 to your computer and use it in GitHub Desktop.
//Woon Jun Shen
//UM402 (433 MHz UART)
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); //TX, RX
// gnd SET_A and SET_B for Normal Mode (Send and Receive)
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
}
void loop() {
if(Serial.available() > 0){//Read from serial monitor and send over UM402
String input = Serial.readString();
mySerial.println(input);
}
if(mySerial.available() > 1){//Read from UM402 and send to serial monitor
String input = mySerial.readString();
Serial.println(input);
}
delay(20);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment