Created
October 2, 2013 22:38
-
-
Save x56/6801541 to your computer and use it in GitHub Desktop.
Arduino sketch to go with pyCraft fork
This file contains hidden or 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 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