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

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.