Created
September 8, 2016 07:17
-
-
Save Jswoon/24d9d9a72c0111360227978ab21fb6d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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