Arduino Wireless Bi-Directional Communication - Arduino NRF24L01 Tutorial

Wireless communication transceiver module
Table of Contents

Advertisement

By using the "&" before the variable name we actually set an indicating of the variable that
stores the data that we want to be sent and using the second argument we set the number
of bytes that we want to take from that variable. In this case the sizeof() function gets all
bytes of the strings "text". At the end of the program we will add 1 second delay.
On the other side, at the receiver, in the loop section using the radio.available() function
we check whether there is data to be received. If that's true, first we create an array of 32
elements, called "text", in which we will save the incoming data.
1.void loop() {
2.if (radio.available()) {
3.char text[32] = "";
4.radio.read(&text, sizeof(text));
5.Serial.println(text);
6.}
7.}
Using the radion.read() function we read and store the data into the "text" variable. At the
end we just print text on the serial monitor. So once we upload both programs, we can run
the serial monitor at the receiver and we will notice the message "Hello World" gets printed
each second.

Arduino Wireless Bi-directional Communication

Let's see the second example, a bi-directional wireless communication between two
Arduino boards. Here's the circuit schematics:
You can get the components needed for this example from the links below:
• NRF24L01 Transceiver Module.............
Amazon
/
DealExtreme

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the NRF24L01 and is the answer not in the manual?

Table of Contents