PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

33 linhas
764B

  1. // ask_receiver.pde
  2. // -*- mode: C++ -*-
  3. // Simple example of how to use RadioHead to receive messages
  4. // with a simple ASK transmitter in a very simple way.
  5. // Implements a simplex (one-way) receiver with an Rx-B1 module
  6. #include <RH_ASK.h>
  7. #include <SPI.h> // Not actualy used but needed to compile
  8. RH_ASK driver;
  9. // RH_ASK driver(2000, 2, 4, 5); // ESP8266: do not use pin 11
  10. void setup()
  11. {
  12. Serial.begin(9600); // Debugging only
  13. if (!driver.init())
  14. Serial.println("init failed");
  15. }
  16. void loop()
  17. {
  18. uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
  19. uint8_t buflen = sizeof(buf);
  20. if (driver.recv(buf, &buflen)) // Non-blocking
  21. {
  22. int i;
  23. // Message with a good checksum received, dump it.
  24. driver.printBuffer("Got:", buf, buflen);
  25. }
  26. }