Skip to content

Instantly share code, notes, and snippets.

@mattwilliamson
Created August 17, 2010 04:07
Show Gist options
  • Save mattwilliamson/528417 to your computer and use it in GitHub Desktop.
Save mattwilliamson/528417 to your computer and use it in GitHub Desktop.
int ledPin = 13;
boolean ledOn = false;
void setup() {
pinMode(ledPin, OUTPUT); // Set servo pin as an output pin
Serial.begin(9600);
//Serial.println("Arduino serial");
}
void loop() {
if (Serial.available() > 0) {
int message = Serial.read();
if (message == 49) { digitalWrite(ledPin, HIGH); }
if (message == 48) { digitalWrite(ledPin, LOW); }
// print pulseWidth back to the Serial Monitor (uncomment to debug)
// Serial.print("Pulse Width: ");
// Serial.print(pulseWidth);
// Serial.println("us"); // microseconds
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment