Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* TRASMETTITORE PROVA NRF24L01
- */
- #include<SPI.h>
- #include<nRF24L01.h>
- #include<RF24.h>
- const uint64_t pipe = 0xE8E8F0F0E1LL;
- #define CE D2
- #define CSN D8
- RF24 radio(CE, CSN);
- int pulsante = D4;
- int statopulsante;
- int datodainviare[2];
- void setup(){
- Serial.begin(9600);
- pinMode(pulsante, INPUT_PULLUP);
- radio.begin();
- radio.openWritingPipe(pipe);
- }
- void loop(){
- statopulsante = digitalRead(pulsante);
- Serial.println(statopulsante);
- if(statopulsante == LOW){
- datodainviare[0] = 1;
- }
- else{
- datodainviare[0] = 0;
- }
- radio.write(&datodainviare, sizeof(datodainviare));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement