Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; AntiBotCaptcha has a deprecated constructor in /homepages/8/d680172117/htdocs/QA/qa-plugin/q2a-captcha-antibot-master/AntiBotCaptcha.php on line 22
question about arduino flight controller - Electronoobs Q&A

Welcome to Electronoobs Q&A, where you can ask questions and receive answers from other members of the community.


PCBWay Ad

Categories


+1 vote

Dear ,

I really like your channel on Youtube and your website 

I built my own Arduino transmitter and receiver thanks to you so also I'm looking to build the flight controller so is it possible to build it with fails safe if lost transmitter signal

can we put a code same to this one bellow in the flight controller code 

((

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();

}

 

pwm_width_2 = map(data.throttle, 0, 255, 1000, 2000);     //PWM value on digital pin D2

pwm_width_3 = map(data.yaw,      0, 255, 1000, 2000);     //PWM value on digital pin D3

pwm_width_4 = map(data.pitch,    0, 255, 1000, 2000);     //PWM value on digital pin D4

pwm_width_5 = map(data.roll,     0, 255, 1000, 2000);     //PWM value on digital pin D5

pwm_width_6 = map(data.AUX1,     0, 255, 1000, 2000);     //PWM value on digital pin D6

pwm_width_7 = map(data.AUX2,     0, 255, 1000, 2000);     //PWM value on digital pin D7

 ))

Thanks

asked in Arduino by (130 points)

2 Answers

0 votes
Well, this is just the received values. You need a PID algorithm to control the drone!
answered by (23.2k points)
I thought that we can use the arduino receiver act as fail safe system when nRF24L01 is lost

for example if the signal lost from the transmitter the receiver will send the PWM  signals in place of transmitter to the flight controller to slow down the throttle till 0 value

in that case If sate will be fine right ??

do you think this will work ?
0 votes
Why is map function used? Are you mapping values form 0-255 to 1000-2000 range? what is it for?
answered by (230 points)
thanks for your reply

honestly I'm not good that much at complicated  arduino code so I'm still improving

also those values i have taken them YFC3D it is from youtube  same one build a fight controller as I know analog output range from 0 to 255
...