How to program drone transmitter

0

 



Hello guys my self Pankaj and welcome to The Electronics Creator. in this video we are going to learn how to program to drone transmitter and connect transmitter and receiver with each other and see reading on PC. you will find all lings on our link

download here

drone receiver test code:


[code]

/* Test code for the Radio control transmitter

 *  Install the NRF24 library to your IDE

 * Upload this code to the Arduino UNO

 * Connect a NRF24 module to it:

 

    Module // Arduino UNO

    

    GND    ->   GND

    Vcc    ->   3.3V

    CE     ->   D9

    CSN    ->   D10

    CLK    ->   D13

    MOSI   ->   D11

    MISO   ->   D12


This code should print the received values to the serial monitor

Please, like share and subscribe : https://www.youtube.com/c/ELECTRONOOBS

*/


#include <SPI.h>

#include <nRF24L01.h>

#include <RF24.h>

const uint64_t pipeIn = 0xE8E8F0F0E1LL; //Remember that this code is the same as in the transmitter


RF24 radio(9, 10); 


//We could use up to 32 channels

struct MyData {

byte throttle; //We define each byte of data input, in this case just 6 channels

byte yaw;

byte pitch;

byte roll;

byte AUX1;

byte AUX2;

};


MyData data;


void resetData()

{

//We define the inicial value of each data input

//3 potenciometers will be in the middle position so 127 is the middle from 254

data.throttle = 0;

data.yaw = 127;

data.pitch = 127;

data.roll = 127;

data.AUX1 = 0;

data.AUX2 = 0;


}


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


void setup()

{

Serial.begin(250000); //Set the speed to 9600 bauds if you want.

//You should always have the same speed selected in the serial monitor

resetData();

radio.begin();

radio.setAutoAck(false);

radio.setDataRate(RF24_250KBPS);


radio.openReadingPipe(1,pipeIn);

//we start the radio comunication

radio.startListening();


}


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


unsigned long lastRecvTime = 0;


void recvData()

{

while ( radio.available() ) {

radio.read(&data, sizeof(MyData));

lastRecvTime = millis(); //here we receive the data

}

}


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


void loop()

{

recvData();

unsigned long now = millis();

//Here we check if we've lost signal, if we did we reset the values 

if ( now - lastRecvTime > 1000 ) {

// Signal lost?

resetData();

}


Serial.print("Throttle: "); Serial.print(data.throttle);  Serial.print("    ");

Serial.print("Yaw: ");      Serial.print(data.yaw);       Serial.print("    ");

Serial.print("Pitch: ");    Serial.print(data.pitch);     Serial.print("    ");

Serial.print("Roll: ");     Serial.print(data.roll);      Serial.print("    ");

Serial.print("Aux1: ");     Serial.print(data.AUX1);      Serial.print("    ");

Serial.print("Aux2: ");     Serial.print(data.AUX2);      Serial.print("\n");




}


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

[/code]


I hope you will understand this video. so, thanks for watching and please like this video, share this video and do subscribe our channel and touch the bell icon to latest update. so we will meet in the next vide. thank you..... your queries: program drone transmitter program drone receiver test drone transmitter and receiver #dronetransmitter #drone #theelectronicscreator

Post a Comment

0Comments
Post a Comment (0)