Created
May 1, 2011 12:19
-
-
Save biomood/950467 to your computer and use it in GitHub Desktop.
Example arduino sketch sending and receiving data via serial
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
char msg = '0'; | |
void setup() { | |
Serial.begin(9600); | |
} | |
void loop(){ | |
// While data is sent over serial assign it to the msg | |
while (Serial.available() > 0){ | |
msg = Serial.read(); | |
} | |
// see what value is given out | |
if (msg != '0') { | |
Serial.print(msg); | |
//Serial.print(msg, BYTE); | |
msg = '0'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment