You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

echo.ino 735B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * echo - echo characters back to bluetooth device
  3. *
  4. * Waits for a connection and then echos each charater received.
  5. *
  6. * Debugging is enabled, so if you open the 'Serial Monitor' you can see
  7. * the search for the HC05 baud and the wait for the BT connection.
  8. */
  9. #include <Arduino.h>
  10. #include "HC05.h"
  11. #ifdef HC05_SOFTWARE_SERIAL
  12. #include <SoftwareSerial.h>
  13. HC05 btSerial = HC05(A2, A5, A3, A4); // cmd, state, rx, tx
  14. #else
  15. HC05 btSerial = HC05(3, 2); // cmd, state
  16. #endif
  17. void setup()
  18. {
  19. DEBUG_BEGIN(57600);
  20. btSerial.findBaud();
  21. }
  22. void loop()
  23. {
  24. btSerial.println("Echo Server- type something");
  25. while (btSerial.connected())
  26. {
  27. if (btSerial.available())
  28. {
  29. btSerial.write(btSerial.read());
  30. }
  31. }
  32. }