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.

46 lines
989 B

7 years ago
6 years ago
7 years ago
7 years ago
  1. /**************************************************************
  2. *
  3. * This script just listens in on the communication
  4. * between an Arduino and the modem.
  5. *
  6. * TinyGSM Getting Started guide:
  7. * https://tiny.cc/tinygsm-readme
  8. *
  9. **************************************************************/
  10. // Set the baud rate between the modem and the board
  11. #define BAUD_RATE 9600
  12. // Set serial printing out the communication
  13. #define SPY Serial
  14. // Set serial for input from modem
  15. #define MODEM_TX Serial1
  16. // Set serial for AT commands (to the module)
  17. // Use Hardware Serial on Mega, Leonardo, Micro
  18. // #define BOARD_TX Serial1
  19. // or AltSoftware
  20. #include <AltSoftSerial.h>
  21. AltSoftSerial BOARD_TX;
  22. void setup() {
  23. // Set console baud rate
  24. SPY.begin(115200);
  25. MODEM_TX.begin(BAUD_RATE);
  26. BOARD_TX.begin(BAUD_RATE);
  27. delay(6000);
  28. }
  29. void loop()
  30. {
  31. while (MODEM_TX.available()) {
  32. SPY.write(MODEM_TX.read());
  33. }
  34. while (BOARD_TX.available()) {
  35. SPY.write(BOARD_TX.read());
  36. }
  37. }