Guest User

Untitled

a guest
Nov 25th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2.  
  3. SoftwareSerial BTSerial(10, 11); // RX | TX
  4.  
  5. void setup() {
  6. pinMode(9, OUTPUT);
  7. // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  8. digitalWrite(9, HIGH);
  9. Serial.begin(9600);
  10. Serial.println("Enter AT commands:");
  11. BTSerial.begin(38400);
  12. // HC-05 default speed in AT command more
  13. }
  14.  
  15. void loop() {
  16. // Keep reading from HC-05 and send to Arduino Serial Monitor
  17. if (BTSerial.available())
  18. Serial.write(BTSerial.read());
  19.  
  20. // Keep reading from Arduino Serial Monitor and send to HC-05
  21. if (Serial.available())
  22. BTSerial.write(Serial.read());
  23. }
Add Comment
Please, Sign In to add comment