Skip to content

Instantly share code, notes, and snippets.

@taesamja
Created January 5, 2017 05:05
Show Gist options
  • Save taesamja/e5f4c6b19b825f038e2afe9c4dd28074 to your computer and use it in GitHub Desktop.
Save taesamja/e5f4c6b19b825f038e2afe9c4dd28074 to your computer and use it in GitHub Desktop.
#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