#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
Содержание nRF24L01
Страница 3: ...3 51...
Страница 4: ...Introduction 4 51...
Страница 7: ...Pin Map 7 51...
Страница 9: ...Preparation Getting Started 9 51...
Страница 11: ...RF24 Library 11 51...
Страница 12: ...RF24 Library 12 51...
Страница 13: ...First Node NodeMCU 13 51...
Страница 14: ...First Node NodeMCU 14 51...
Страница 15: ...Second Node Nano 15 51...
Страница 16: ...Second Node Nano 16 51...
Страница 17: ...Code Play Getting Started 17 51...
Страница 18: ...Simple Transmit Receive NodeMCU Transmit Nano Receive Ref Example Sketches 18 51...
Страница 23: ...RF24 Sample Code 23 51...
Страница 24: ...RF24 Sample Code GettingStarted 24 51...
Страница 30: ...Simple Remote Control 30 51...
Страница 31: ...NodeMCU Remote Controller 31 51...
Страница 32: ...Nano Local Controller 32 51...
Страница 33: ...Simple Remote Control 33 51...
Страница 38: ...Simple Remote Control 38 51...
Страница 39: ...Nano Attach a Device 39 51...
Страница 40: ...Nano Attach a Device 40 51...
Страница 41: ...Connecting to Blynk Cloud Gateway 41 51...
Страница 44: ...Blynk Button with Virtual Pin V1 44 51...
Страница 46: ...Refs Resources 46 51...
Страница 48: ...NodeMCU V1 0 Pin Map 48 51...
Страница 49: ...Nano V3 0 Pin Map 49 51...
Страница 50: ...Nano V3 0 Pin Map 50 51...
Страница 51: ...51 51 END Eueung Mulyana https eueung github io 012017 nrf24 CodeLabs Attribution ShareAlike CC BY SA...