Arduino Codes
First we need to download and install the RF24 library which makes the programming less difficult.
Here are the two codes for the wireless communication and below is the description of them.
Transmitter Code
1./*
2.* Arduino Wireless Communication Tutorial
3.* Example 1 - Transmitter Code
4.*
5.* by Dejan Nedelkovski, www.HowToMechatronics.com
6.*
7.* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
8.*/
9.#include <SPI.h>
10.#include <nRF24L01.h>
11.#include <RF24.h>
12.RF24 radio(7, 8); // CE, CSN
13.const byte address[6] = "00001";
14.void setup() {
15.radio.begin();
16.radio.openWritingPipe(address);
17.radio.setPALevel(RF24_PA_MIN);
18.radio.stopListening();
19.}
20.void loop() {
21.const char text[] = "Hello World";
22.radio.write(&text, sizeof(text));
23.delay(1000);
24.}