#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
RF24
myRadio
(7, 8)
;
const
int
LED =
2
;
byte addresses[][
6
] = {
"1Node"
};
int
dataReceived;
void
setup
()
{
pinMode(LED, OUTPUT);
Serial.begin(
115200
);
delay(
1000
);
myRadio.begin();
myRadio.setChannel(
108
);
myRadio.setPALevel(RF24_PA_MIN);
myRadio.openReadingPipe(
1
, addresses[
0
]);
myRadio.startListening();
}
void
loop
()
{
if
(myRadio.available())
{
while
(myRadio.available())
{
myRadio.read( &dataReceived,
sizeof
(dataReceived) );
}
Serial.print(
"Data received = "
);
Serial.println(dataReceived);
if
(dataReceived ==
10
) {
digitalWrite(LED, LOW);
}
else
{
digitalWrite(LED, HIGH);
}
}
}
36 / 51
Nano
Summary of Contents for nRF24L01
Page 3: ...3 51...
Page 4: ...Introduction 4 51...
Page 7: ...Pin Map 7 51...
Page 9: ...Preparation Getting Started 9 51...
Page 11: ...RF24 Library 11 51...
Page 12: ...RF24 Library 12 51...
Page 13: ...First Node NodeMCU 13 51...
Page 14: ...First Node NodeMCU 14 51...
Page 15: ...Second Node Nano 15 51...
Page 16: ...Second Node Nano 16 51...
Page 17: ...Code Play Getting Started 17 51...
Page 18: ...Simple Transmit Receive NodeMCU Transmit Nano Receive Ref Example Sketches 18 51...
Page 23: ...RF24 Sample Code 23 51...
Page 24: ...RF24 Sample Code GettingStarted 24 51...
Page 30: ...Simple Remote Control 30 51...
Page 31: ...NodeMCU Remote Controller 31 51...
Page 32: ...Nano Local Controller 32 51...
Page 33: ...Simple Remote Control 33 51...
Page 38: ...Simple Remote Control 38 51...
Page 39: ...Nano Attach a Device 39 51...
Page 40: ...Nano Attach a Device 40 51...
Page 41: ...Connecting to Blynk Cloud Gateway 41 51...
Page 44: ...Blynk Button with Virtual Pin V1 44 51...
Page 46: ...Refs Resources 46 51...
Page 48: ...NodeMCU V1 0 Pin Map 48 51...
Page 49: ...Nano V3 0 Pin Map 49 51...
Page 50: ...Nano V3 0 Pin Map 50 51...