Last active
July 15, 2016 06:19
-
-
Save taesamja/c66ba34f6291786f98d233506fb28b8b to your computer and use it in GitHub Desktop.
bluetoot_arduino,ino
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(3,2); //Rx, Tx | |
void setup() { | |
Serial.begin(9600); | |
BTSerial.begin(9600); | |
} | |
void loop() { | |
if(BTSerial.available()) { | |
Serial.write(BTSerial.read()); } | |
if(Serial.available()) { | |
BTSerial.write(Serial.read()); } | |
} | |
#include <SoftwareSerial.h> | |
SoftwareSerial BTSerial(3, 2); //Rx, Tx | |
const int ledPin = 13; | |
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
modified