#include <SoftwareSerial.h> SoftwareSerial BT(10, 11); // RX | TX void setup() { Serial.begin(9600); Serial.println("Please Setting 'Both NL&CR' channel"); Serial.println("Then Enter 'AT+BAUD4' first to set the Baud channel to 9600"); Serial.println("The List of AT Comannd"); Serial.println(" AT : Ceck the connection."); Serial.println(" AT+NAME : See default name"); Serial.println(" AT+PSWD : See default password"); Serial.println(" AT+ORGL : Restore factory settings"); Serial.println(" AT+ADDR : See default address"); Serial.println("Please Enter AT Command"); Serial.println("AT"); pinMode(13, OUTPUT); // HC-06 default serial speed is 9600 BT.begin(9600); } void loop() { // Keep reading from HC-06 and send to Arduino Serial Monitor if (BT.available()) { Serial.write(BT.read()); } // Keep reading from Arduino Serial Monitor and send to HC-06 if (Serial.available()) { BT.write(Serial.read()); } } char a; void loop1() { if (BT.available()) // if text arrived in from BT serial... { a=(BT.read()); if (a=='OK') { digitalWrite(13, HIGH); BT.println("LED on"); } if (a==' ') { digitalWrite(13, LOW); BT.println("LED off"); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)