Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <RH_ASK.h>
- #include <SPI.h> // Not actualy used but needed to compile
- RH_ASK driver;
- void setup()
- {
- pinMode(8, OUTPUT);
- digitalWrite(8,LOW);
- Serial.begin(9600); // Debugging only
- if (!driver.init())
- Serial.println("init failed");
- }
- void loop()
- {
- uint8_t buf[2];
- uint8_t buflen = sizeof(buf);
- if (driver.recv(buf, &buflen)) // Non-blocking
- {
- int i;
- // Message with a good checksum received, dump it.
- Serial.print("Message: ");
- Serial.println((char*)buf);
- digitalWrite(8,HIGH);
- delay(1000);
- digitalWrite(8,LOW);
- delay(500);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement