Skip to content

Instantly share code, notes, and snippets.

@chepecarlos
Created June 24, 2015 16:54
Show Gist options
  • Save chepecarlos/fe6faa5be9685d5b9a99 to your computer and use it in GitHub Desktop.
Save chepecarlos/fe6faa5be9685d5b9a99 to your computer and use it in GitHub Desktop.
Demo de encender un led con HC-05
#include <SoftwareSerial.h>//Se puede emular mas de un puerto serial
int Led = 13;// I/O donde esta conectado el led
SoftwareSerial BTSerial(3, 2); // RX | TX Poner los pines que usas
void setup() {
pinMode(Led, OUTPUT);
BTSerial.begin(9600);//Inicializar comunicacion
}
void loop() {
while (BTSerial.available()) {
char data = (char)BTSerial.read();
if ( data == 'H')
digitalWrite(Led, 1);
else if ( data == 'L')
digitalWrite(Led, 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment