Page 1 of 1

Retractile landing gear

Posted: Thu Jun 09, 2016 1:15 pm
by arduino4fun
Here is how to check the cheerson cx-20/nova copter retractile landing gear using an Arduino UNO board (sketch below) ! (ref hobbyking : http://www.hobbyking.com/…/__75364__Quanum_Nova_Alloy_Elect…)

red cable to the +5v of the UNO
black cable to the gnd of the UNO
white/orange cable to the pin 9 of the UNO

here is the video with the result :

https://youtu.be/JOdkKe0mF2Q

Code: Select all

// ----------------------------------------------------------------------------------------------
 // This sketch allows to move the landing gear up and down
 //
 // https://www.facebook.com/Cheerson-CX-20-Quanum-Nova-1512…/…/
 // https://www.facebook.com/arduino4fun
 // http://www.arduino4fun.com
 // ----------------------------------------------------------------------------------------------

int ledpin=12; // Define the digital interface signal line 12 is connected to the landing gear

int NbTrial = 1;

‪#‎include‬ <Servo.h> // servo library

Servo servo1; // servo control object

void Retract()
 {
 int position;

// Tell servo to go to 180 degrees, stepping by two degrees
 for(position = 0; position < 180; position += 1)
 {
 servo1.write(position); // Move to next position
 delay(50); // Short pause to allow it to move
 }
 }

void Extract()
 {
 int position;
 // Tell servo to go to 0 degrees, stepping by one degree

for(position = 180; position >= 0; position -= 1)
 {
 servo1.write(position); // Move to next position
 delay(50); // Short pause to allow it to move
 }
 }

void setup()
 {
 Serial.begin(9600);
 servo1.attach(9);
 }

void loop()
 {
 int position;

if( NbTrial<=0 )
 return;

Retract();
 delay(3000);
 Extract();
 delay(3000);

NbTrial--;
 return;
 }
 


Image
Image
Image