Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SPI.h>
- #include <nRF24L01.h>
- #include <RF24.h>
- RF24 radio(7,8);
- const byte address[6] = "00001";
- const int buzzer = 4;
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600);
- radio.begin();
- radio.openReadingPipe(0,address);
- radio.setPALevel(RF24_PA_MAX);
- radio.setDataRate(RF24_250KBPS);
- radio.startListening();
- }
- void loop() {
- byte gotnum = 0;
- if (radio.available()) {
- radio.read(&gotnum, sizeof(gotnum));
- Serial.println("OK");
- tone(buzzer, 500);
- delay(10);
- noTone(buzzer);
- delay(500);
- }
- else
- {
- Serial.println("__");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment