- #define led 7
- int a = 0;
- #include <SoftwareSerial.h>
- SoftwareSerial bt(3, 2); // RX, TX
- void setup() {
- pinMode(led, OUTPUT);
- Serial.begin(9600);
- bt.begin(9600);
- }
- void loop() {
- if(bt.available() != 0){
- a= bt.read();
- }
- if (a== '0') {
- digitalWrite(ledPin, LOW);
- }
- else if (a== '1') {
- digitalWrite(ledPin, HIGH);
- }
- }
Recent Pastes