LED MODE INDICATORS ON MOTOR ARMS

Does any1 have an idea on how to setup the arducopter to indicate via different color leds on the motor mounts as to what mode the copter is in, eg. stabilize, alt hold, loiter.

From what i can see in the code (APM_Config.h)

There are these lines:

#define MOTOR_LEDS 1 // 0 = off, 1 = on

#define FR_LED AN12 // Mega PE4 pin, OUT7
#define RE_LED AN14 // Mega PE5 pin, OUT6
#define RI_LED AN10 // Mega PH4 pin, OUT5
#define LE_LED AN8 // Mega PH5 pin, OUT4

From my limited knowledge of C.

The above pins can be set to different conditions (HIGH or LOW), so instead of using them for individual motors, we could use each one for a color of led and mode.

EG.
1. Mount tri color leds on all the motor mounts.
2. Connect pin PE4 to the blue leds (stabilize)
3. Connect pin PE5 to the red leds (loiter)
4. Connect pin PH4 to the green leds (auto)

Then in the code find the variable that is set for the mode. (im still looking...)

Then a simple if then else in the setup loop() (or a function can be made)

if ( stabilizeMode = 1 ) {
digitalWrite(PE4, HIGH);
}

and the same for the other 2 modes.

My syntax is probably not 100%.

But will the idea work????

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Hear is the proof of concept

     

    using the LED instruction/wiring hear is the vid using the LEDS.pde with if then statement but I think switch is better

     

  • I see two possible way
    maybe on ArducopterMega

    switch(control_mode)

    then include the

    digitalWrite(RE_LED, HIGH);

    to the mode you need

    lastly one LEDS comment out the whole

    "static void update_motor_leds(void)"

    Or you can edit the LEDS

    "static void update_motor_leds(void)"

    and make your if then

    if (control_mode == SIMPLE)
      {digitalWrite(RE_LED, HIGH);}

     

    this way you dont mess the main and keep everything on the LEDS pde

     

    something like that. warning not sure how it will affect the processing but should be that much.

     

    If I get some time maybe I will play with it

    Disclaimer I am no expert :D

  • 100KM
    Can the APM outputs supply enough current to drive 3 leds ? I thought they can only supply 40mA, which is just enough for 1 led.
This reply was deleted.

Activity