In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless
If you put code tags around the bit of code you posted - as suggested - then it'll make sense to the rest of us, rather than us trying to decode smileys ....
It also help to know that centre_channel_1 is defined as an int.
The first bit of code is writing a 16-bit int to the EEPROM by splitting it into 2 8-bit values. The second bit of code is re-assembling the 2 8-bit values back into the 16-bit int and checking that they match.
markd833:
If you put code tags around the bit of code you posted - as suggested - then it'll make sense to the rest of us, rather than us trying to decode smileys ....
It also help to know that centre_channel_1 is defined as an int.
The first bit of code is writing a 16-bit int to the EEPROM by splitting it into 2 8-bit values. The second bit of code is re-assembling the 2 8-bit values back into the 16-bit int and checking that they match.
Thank you so much for help. and also I learn how to put section of code.
again, the following code write center_channel, low_channel, high_channel values into EEPROM, the thing is I didn't find any where the high_channel defined, I mean not assigned like:
low_channel_1 = receiver_input_channel_1;
how can write it?
TheMemberFormerlyKnownAsAWOL:
Well, it's obviously not in that snippet, is it?
Thanks.
Sure, sorry I did't attached the code here, it was attached at the topic post. where the low_channel and center_channel was assigned, but the high_channel.
Best
Thank you.
I checked this, it confused me cause of it used 'high_channel' as a condition to do compare before assigned 'high_channel'.
Is it OK to do that way?
Best
would be unnecessary if you used EEPROM.put() and EEPROM.get() to save and load the values which could be done in a single statement for each
Out of interest, what is the highest value that any of the channel variables could be ?
Thank you.
My model is not ready to do the measurement yet, according to the controller code, the the highest value that any of the channel was set to 2000, and the min. set as 1000. The code we are talking now is for setup.
It is: Brokking.net - Project YMFC-AL - The Arduino auto-level quadcopter - Home.
I measured the ESC pulse during drone motor running, the front L/R = 1200, and rear L/R 740 ? why such big gap?
The measurements above was done when push the pitch rod only, I mean I just let it go straight up, and the drone is assembled quite balanced and stand on the floor.
I was expect the 4 motors should run same RPM? or it will flip off, in fact it did flip back to front. don't know why?
the following code is for the drone straight up take off (if i'm not wrong), I don't know why?
if (start == 2){ //The motors are started.[color=#181818][/color]
if (throttle > 1800) throttle = 1800; //We need some room to keep full control at full throttle.[color=#181818][/color]
esc_1 = throttle - pid_output_pitch + pid_output_roll - pid_output_yaw; //Calculate the pulse for esc 1 (front-right - CCW)[color=#181818][/color]
esc_2 = throttle + pid_output_pitch + pid_output_roll + pid_output_yaw; //Calculate the pulse for esc 2 (rear-right - CW)[color=#181818][/color]
esc_3 = throttle + pid_output_pitch - pid_output_roll - pid_output_yaw; //Calculate the pulse for esc 3 (rear-left - CCW)[color=#181818][/color]
esc_4 = throttle - pid_output_pitch - pid_output_roll + pid_output_yaw; //Calculate the pulse for esc 4 (front-left - CW)