Skip to content

Instantly share code, notes, and snippets.

@taesamja
Last active July 15, 2016 06:19
Show Gist options
  • Save taesamja/c66ba34f6291786f98d233506fb28b8b to your computer and use it in GitHub Desktop.
Save taesamja/c66ba34f6291786f98d233506fb28b8b to your computer and use it in GitHub Desktop.
bluetoot_arduino,ino
#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);
}
}
@taesamja
Copy link
Author

modified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment