Skip to content

Instantly share code, notes, and snippets.

@anoochit
Created September 6, 2014 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anoochit/6374e8959cb19feca3bb to your computer and use it in GitHub Desktop.
Save anoochit/6374e8959cb19feca3bb to your computer and use it in GitHub Desktop.
bluetooth basic
char BYTE;
int LED = 13; // LED on pin 13
void setup() {
Serial.begin(9600);
pinMode(LED, OUTPUT);
}
void loop() {
Serial.println("Press 1 to turn Arduino pin 13 LED ON or 0 to turn it OFF:");
while (!Serial.available()); // stay here so long as COM port is empty
BYTE = Serial.read(); // read next available byte
Serial.print(BYTE);
if( BYTE == '0' ) digitalWrite(LED, LOW); // if it's a 0 (zero) tun LED off
if( BYTE == '1' ) digitalWrite(LED, HIGH); // if it's a 1 (one) turn LED on
delay(50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment