Guest User

Untitled

a guest
Aug 24th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2. int bluetoothTx = 10; // TX-O pin of bluetooth
  3. int bluetoothRx = 11; // RX-I pin of bluetooth
  4. SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
  5. void setup(){
  6. Serial.begin(9600); // Begin the serial monitor at 9600bps
  7. delay(200);
  8. bluetooth.begin(9600); // Start bluetooth serial at 9600
  9. Serial.print("send...");
  10. bluetooth.print("AT");
  11. bluetooth.print("110"); //open relay 1
  12. delay(2000);
  13. bluetooth.print("100"); //close relay 1
  14. }
  15. void loop(){
  16. if(bluetooth.available()){
  17. Serial.print((char)bluetooth.read());
  18. }
  19. if(Serial.available()){
  20. bluetooth.print((char)Serial.read());
  21. }
  22. }
Add Comment
Please, Sign In to add comment