#include <SoftwareSerial.h>
SoftwareSerial BTSerial(12, 13);
void setup() {
Serial.begin(9600);
BTSerial.begin(9600);
}
void loop() {
if (BTSerial.available())
Serial.write(BTSerial.read());
if (Serial.available())
BTSerial.write(Serial.read());
}
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(12, 13);
int led = 8;
char command;
void setup() {
Serial.begin(9600);
BTSerial.begin(9600);
}
void loop() {
if (BTSerial.available()){
char command = BTSerial.read();
Serial.println(char(command));
if (command == ‘Y’ || command == ‘y’) {
digitalWrite(led, HIGH);
}
else if(command == ‘N’ || command == ‘n’){
digitalWrite(led, LOW);
}
}
}
Comments
Please log in or sign up to comment.