Skip to content

Instantly share code, notes, and snippets.

@biomood
Created May 1, 2011 12:19
Show Gist options
  • Save biomood/950467 to your computer and use it in GitHub Desktop.
Save biomood/950467 to your computer and use it in GitHub Desktop.
Example arduino sketch sending and receiving data via serial
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