#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
RF24
myRadio
(2, 15)
;
const
int
SW1 =
5
;
byte addresses[][
6
] = {
"1Node"
};
int
dataTransmitted;
int
button;
void
setup
()
{
pinMode(SW1, INPUT);
dataTransmitted =
10
;
button =
0
;
Serial.begin(
115200
);
delay(
1000
);
myRadio.begin();
myRadio.setChannel(
108
);
myRadio.setPALevel(RF24_PA_MIN);
myRadio.openWritingPipe( addresses[
0
]);
delay(
1000
);
}
void
loop
()
{
int
newButton = digitalRead(SW1);
if
(newButton != button) {
button = newButton;
if
(button == HIGH){
dataTransmitted =
20
;
}
else
{
dataTransmitted =
10
;
}
myRadio.write( &dataTransmitted,
sizeof
(dataTransmitted) );
Serial.print(F(
"Data Transmitted = "
));
Serial.println(dataTransmitted);
}
34 / 51
NodeMCU
Содержание 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...