Last active
December 17, 2015 01:39
-
-
Save shahrulnizam/5530086 to your computer and use it in GitHub Desktop.
ChipKIT Lesson: UART
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
int data; | |
void setup() | |
{ | |
Serial.begin(9600); | |
Serial1.begin(9600); | |
Serial.println("Serial 0 Ready!"); | |
Serial1.println("Serial 1 Ready!"); | |
} | |
void loop() | |
{ | |
if(Serial.available()>0) | |
{ | |
Serial1.print("Serial 0 Sent: "); | |
while(Serial.available()>0) | |
{ | |
data=Serial.read(); | |
Serial1.write(data); | |
} | |
Serial1.println(); | |
} | |
if(Serial1.available()>0) | |
{ | |
Serial.print("Serial 1 Sent: "); | |
while(Serial1.available()>0) | |
{ | |
data=Serial1.read(); | |
Serial.write(data); | |
} | |
Serial.println(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment