Skip to content

Instantly share code, notes, and snippets.

@taesamja
Created January 5, 2017 04:03
Show Gist options
  • Save taesamja/a1942ce1f465605fca1945361294246b to your computer and use it in GitHub Desktop.
Save taesamja/a1942ce1f465605fca1945361294246b to your computer and use it in GitHub Desktop.
#include <SoftwareSerial.h>
int rx=2; int tx=3;
SoftwareSerial BTSerial(rx, tx);
const int ledPin = 13;
void setup() {
BTSerial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
if(BTSerial.available()) {
char ind = BTSerial.read();
if(ind == 'H')
digitalWrite(ledPin, HIGH);
if(ind == 'L')
digitalWrite(ledPin, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment