Created
January 5, 2017 05:05
-
-
Save taesamja/e5f4c6b19b825f038e2afe9c4dd28074 to your computer and use it in GitHub Desktop.
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
#include <SoftwareSerial.h> | |
SoftwareSerial BTSerial(2, 3); | |
const int ledPin = 9; | |
char indata; | |
void setup() { | |
BTSerial.begin(9600); | |
pinMode(ledPin, OUTPUT); | |
} | |
void loop() { | |
if(BTSerial.available()) { | |
indata = BTSerial.read(); | |
if(indata == 'H') | |
digitalWrite(ledPin, HIGH); | |
if(indata == 'L') | |
digitalWrite(ledPin, LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment