- #define led 7
- char a ;
- #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(led, LOW);
- }
- else if (a== '1') {
- digitalWrite(led, HIGH);
- }
- }
Recent Pastes