Last active
July 6, 2020 16:09
-
-
Save aattk/61da0a70e97ad0065da69c6b2a1f2f2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SPI.h> | |
| #include "RF24.h" | |
| RF24 radio(9,10); | |
| void setup() { | |
| // put your setup code here, to run once: | |
| Serial.begin(9600); | |
| radio.begin(); | |
| radio.setPALevel(RF24_PA_MAX); | |
| radio.setChannel(0x76); | |
| radio.openWritingPipe(0xF0F0F0F0E1LL); | |
| radio.enableDynamicPayloads(); | |
| radio.powerUp(); | |
| } | |
| void loop() { | |
| // put your main code here, to run repeatedly: | |
| const char text[] = "on"; | |
| const char text2[] = "off"; | |
| radio.write(&text2,3); | |
| int al = 0; | |
| if(Serial.available() > 0){ | |
| al = Serial.read(); | |
| if(al == 49){ | |
| radio.write(&text,2); | |
| Serial.println(al); | |
| } | |
| else if(al == 48){ | |
| radio.write(&text2,3); | |
| Serial.println(al); | |
| } | |
| else{ | |
| Serial.println(al); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment