Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SoftwareSerial.h>//chama biblioteca Bluetooth
- SoftwareSerial Bluetooth (10, 11); //RX, TX
- byte led_1 = 2;
- byte led_2 = 3;
- int Blue_data;
- void setup(){
- Serial.begin(9600);
- Bluetooth.begin (9600);//velocidade serial para o bluetooth
- pinMode (led_1, OUTPUT);
- pinMode (led_2, OUTPUT);
- }
- void loop(){
- if (Bluetooth.available())
- {
- Blue_data = Bluetooth.read();
- //---------------- LED 1
- if (Blue_data == '1'){
- digitalWrite (led_1, HIGH);
- //Bluetooth.println ("Rele 1- ON");//print no celular
- }
- if (Blue_data == '2'){
- digitalWrite (led_1, LOW);
- // Bluetooth.println ("Rele 1- OFF");//print no celular
- }
- // -------------- LED 2
- if (Blue_data == '3'){
- digitalWrite (led_2, HIGH);
- // Bluetooth.println ("Rele 2 - ON");//print no celular
- }
- if (Blue_data == '4'){
- digitalWrite (led_2 , LOW);
- //Bluetooth.println ("Rele 2 - ON");//print no celular
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement