Engineers Gallery

Arduino & NRF24L01 Wireless Remote Control

Introduction

NRF24L01 wireless module, a modüldür.nrf24l01 the desteklemektedir.fiyat the SPI interface for making low-power wireless communication in the 2.4 GHz frequency is also quite cheap, this product can be obtained from the market in Turkey maker robotistan.co address.

Features

Scope of application

Study Application

Enable basically two LEDs wirelessly control with two buttons . application basis if they can control the motor with the button, you improve your home’s lights or control spy robot applications up to you.

Used materials

NRF24L01 Connection with Arduino

Arduino NRF24L01

Button binding logic as in this way button will be connected to the Arduino No. 6 pins.

LEDs in this way will be connected to the Arduino  Led No. 3 pins.

Arduino code

Buyers Codes

#include<SPI.h>
#include"nRF24L01.h"
#include"RF24.h"
int msg[1];
RF24 radio(9,10);
constuint64_t pipe = 0xE8E8F0F0E1LL;
int LED1 = 3;
int LED2 = 5;
void setup(void){
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);}
void loop(void){
if(radio.available()){
bool done = false;
while(!done){
done = radio.read(msg, 1);
Serial.println(msg[0]);
if(msg[0] == 111){delay(10);digitalWrite(LED1, HIGH);}
elseif(msg[0] == 112) {digitalWrite(LED1, LOW);}
elseif(msg[0] == 113) {delay(10);digitalWrite(LED2,HIGH);}
else{digitalWrite(LED2, LOW);}
delay(10);}}
else{Serial.println("boş");}}

Transmitter Codes

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int msg[1];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int SW1 = 7;
int SW2 = 6;
void setup(void){
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe);}
void loop(void){
if (digitalRead(SW1) == HIGH){
msg[0] = 111;
radio.write(msg, 1);}
if (digitalRead(SW1) == LOW){
msg[0] = 112;
radio.write(msg, 1);}
if (digitalRead(SW2) == HIGH){
msg[0] = 113;
radio.write(msg, 1);}
if (digitalRead(SW2) == LOW){
msg[0] = 114;
radio.write(msg, 1);}}

 

Exit mobile version