Advertisement
KelvinMead

cc2451 / hm-10

Jun 24th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. /************************************************************
  2. BLE CC41A Bluetooth
  3. This is a clone of the HM10 BLE board
  4.  
  5. In the Serial Monitor ensure that 'Both NL and CR' is selected
  6. Select a Baud Rate of 9600
  7. ********************************************************/
  8. #include <SoftwareSerial.h>
  9. SoftwareSerial bluetooth(7, 8); // RX, TX
  10.  
  11. void setup()
  12. {
  13. // Start the hardware serial port
  14. Serial.begin(9600);
  15. bluetooth.begin(9600);
  16. }
  17.  
  18. void loop()
  19. {
  20. bluetooth.listen();
  21. // while there is data coming in, read it
  22. // and send to the hardware serial port:
  23. while (bluetooth.available() > 0) {
  24. char inByte = bluetooth.read();
  25. Serial.write(inByte);
  26. }
  27.  
  28. // Read user input if available.
  29. if (Serial.available()){
  30. delay(10); // The DELAY!
  31. bluetooth.write(Serial.read());
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement