Created
September 6, 2014 16:57
-
-
Save anoochit/6374e8959cb19feca3bb to your computer and use it in GitHub Desktop.
bluetooth basic
This file contains 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
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