Advertisement
safwan092

Untitled

Sep 10th, 2023
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <RH_ASK.h>
  2. #include <SPI.h> // Not actualy used but needed to compile
  3.  
  4. RH_ASK driver;
  5.  
  6. void setup()
  7. {
  8. pinMode(8, OUTPUT);
  9. digitalWrite(8,LOW);
  10. Serial.begin(9600); // Debugging only
  11. if (!driver.init())
  12. Serial.println("init failed");
  13. }
  14.  
  15. void loop()
  16. {
  17. uint8_t buf[2];
  18. uint8_t buflen = sizeof(buf);
  19. if (driver.recv(buf, &buflen)) // Non-blocking
  20. {
  21. int i;
  22. // Message with a good checksum received, dump it.
  23. Serial.print("Message: ");
  24. Serial.println((char*)buf);
  25. digitalWrite(8,HIGH);
  26. delay(1000);
  27. digitalWrite(8,LOW);
  28. delay(500);
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement