Skip to content

Instantly share code, notes, and snippets.

@x56
Created October 2, 2013 22:38
Show Gist options
  • Save x56/6801541 to your computer and use it in GitHub Desktop.
Save x56/6801541 to your computer and use it in GitHub Desktop.
Arduino sketch to go with pyCraft fork
int incomingByte = 0;
void setup() {
pinMode(2, OUTPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
incomingByte = Serial.read();
if (incomingByte == 0x41) {
digitalWrite(2, HIGH);
digitalWrite(13, HIGH);
}
else if (incomingByte == 0x42) {
digitalWrite(2, LOW);
digitalWrite(13, LOW);
}
else {
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment