CPP 61
Hc-05 led arduino uno fixed Guest on 3rd February 2024 08:01:49 AM
  1.  
  2.  
  3.     #define led 7
  4.     char a ;
  5.     #include <SoftwareSerial.h>
  6.      
  7.     SoftwareSerial bt(3, 2); // RX, TX
  8.      
  9.      
  10.     void setup() {
  11.       pinMode(led, OUTPUT);
  12.       Serial.begin(9600);
  13.             bt.begin(9600);
  14.     }
  15.      
  16.     void loop() {
  17.       if(bt.available() != 0){
  18.         a= bt.read();
  19.      }
  20.      
  21.      if (a== '0') {
  22.       digitalWrite(led, LOW);
  23.      }
  24.      else if (a== '1') {
  25.       digitalWrite(led, HIGH);
  26.      }
  27.     }

Hightechrobo bin is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.