Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SoftwareSerial.h>
- int bluetoothTx = 10; // TX-O pin of bluetooth
- int bluetoothRx = 11; // RX-I pin of bluetooth
- SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
- void setup(){
- Serial.begin(9600); // Begin the serial monitor at 9600bps
- delay(200);
- bluetooth.begin(9600); // Start bluetooth serial at 9600
- Serial.print("send...");
- bluetooth.print("AT");
- bluetooth.print("110"); //open relay 1
- delay(2000);
- bluetooth.print("100"); //close relay 1
- }
- void loop(){
- if(bluetooth.available()){
- Serial.print((char)bluetooth.read());
- }
- if(Serial.available()){
- bluetooth.print((char)Serial.read());
- }
- }
Add Comment
Please, Sign In to add comment