Advertisement
Guest User

Sidarduino

a guest
Apr 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2. SoftwareSerial BTserial(10, 11); // RX | TX
  3.  
  4. char c = '-';
  5. char d = '-';
  6. void setup()
  7. {
  8. Serial.begin(9600);
  9. Serial.println("Arduino is ready");
  10.  
  11. // HC-05 default serial speed for commincation mode is 9600
  12. BTserial.begin(9600);
  13. }
  14.  
  15. void loop()
  16. {
  17.  
  18. // Keep reading from HC-05 and send to Arduino Serial Monitor
  19. if (BTserial.available())
  20. {
  21. c = BTserial.read();
  22. Serial.write(c);
  23. }
  24.  
  25. // Keep reading from Arduino Serial Monitor and send to HC-05
  26. if (Serial.available())
  27. {
  28. d = Serial.read();
  29. BTserial.write(d);
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement