yt_link
insta_link
fb_link
twitter_link

NRF24 transmitter TEST code


NRF24 transmitter TEST code


Download the .zip file below. Open it on your Arduino IDE and upload it to the Arduino on the TEST breadboard with the potentiometer connected to A0.




This code is for the schematic.






/* Tranmsitter code for the Arduino Radio control with PWM output
 * Install the NRF24 library to your IDE
 * Upload this code to the Arduino UNO, NANO, Pro mini (5V,16MHz)
 * Connect a NRF24 module to it:
 
    Module // Arduino UNO,NANO
    
    GND    ->   GND
    Vcc    ->   3.3V
    CE     ->   D9
    CSN    ->   D10
    CLK    ->   D13
    MOSI   ->   D11
    MISO   ->   D12

This code transmits 1 channels with data from pins A0 POTENTIOMETER
Please, like share and subscribe : https://www.youtube.com/c/ELECTRONOOBS
*/

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

const uint64_t my_radio_pipe = 0xE8E8F0F0E1LL; //Remember that this code should be the same for the receiver

RF24 radio(9, 10);

// The sizeof this struct should not exceed 32 bytes
struct Data_to_be_sent {
  byte ch1; 
};

Data_to_be_sent sent_data;



void setup()
{
  radio.begin();
  radio.setAutoAck(false);
  radio.setDataRate(RF24_250KBPS);
  radio.openWritingPipe(my_radio_pipe);  
  sent_data.ch1 = 127;
  
}

/**************************************************/


void loop()
{
  /*If your channel is reversed, just swap 0 to 255 by 255 to 0 below
  EXAMPLE:
  Normal:    data.ch1 = map( analogRead(A0), 0, 1024, 0, 255);
  Reversed:  data.ch1 = map( analogRead(A0), 0, 1024, 255, 0);  */
  
  sent_data.ch1 = map( analogRead(A0), 0, 1024, 0, 255);

  radio.write(&sent_data, sizeof(Data_to_be_sent));
}


NRF24 tutorial connection












ADVERTISERS
ANENG
cooleme TV
PCBWay Ad



AFFILATE



Anet A8







Gearbest Anycubic I3 MEGA Full Metal Frame FDM 3D Printer
Anycubic I3 MEGA Full Metal Frame FDM 3D Printer only $379.99 with coupon "Anycubici3ch"
Gearbest Anet A8 Desktop 3D Printer
Anet A8 Desktop 3D Printer only $145.99 with coupon "A8KIDA"


Gearbest Tronxy X3S Aluminum Frame LCD Screen  3D Printer DIY Kit
Tronxy X3S Aluminum Frame LCD Screen 3D Printer DIY Kit only $259.99 with coupon "GBX3S"


Gearbest Min DS202 Oscilloscope 113€
Min DS202 Oscilloscope 113€


Gearbest UTD2052CL DIGITAL 2-ch Oscilloscope 275€
UTD2052CL DIGITAL 2-ch Oscilloscope 275€


Gearbest UT139C True RMS Digital Multimeter 29€
UT139C True RMS Digital Multimeter 29€


Gearbest SBK8586 Soldering station Hot Air + Iron 63€
SBK8586 Soldering station Hot Air + Iron 63€


Gearbest BAYANGTOYS X21 Brushless RC Quadcopter
BAYANGTOYS X21 Brushless RC Quadcopter 153€