Hi all,
I have a prolem that my APM2 board is in a hidden location inside my plane and I cannot see the status leds, specially the GPS Fix led.
I was wondering if it is possible to connect an external led to one of the APM2 interfaces/outputs in order to reflect the GPS Fix status (even if it requires coding).
Any suggestions on how to do this?
Thank you.
Best regards,
Jaime
Tags:

If you use an external GPS, you can just mount it so you can see its fix LED.
Permalink Reply by Jaime Felipe on July 22, 2012 at 6:52am Hi Chris,
One of the things that I like most about APM 2 is that you were able to encapsulate all the components in a single block. Because of that I am avoiding to use an external GPS.
As an alternative, I though about using the NAV Leds pins available in the board. Is it possible? How can access them from coding?
As a last option, I also thought of using a micro servo connect on one of the available channels, in which I can signal from code when there is a GPS Fix.
What option do you think is best?
Thank you very much.
Best regards,
Jaime Felipe

Sure, I think you can use any of the free Analog pins. Just add an analogWrite(pin number) command to the code where you want it.
Permalink Reply by Jaime Felipe on July 22, 2012 at 10:05am Great!
How can I find out the pin number of the NAV LED A7 connector?

Isn't that just pin 7?
Permalink Reply by Jaime Felipe on July 22, 2012 at 11:30am It seems to me that it isn't.
Running the code below, one of the servos of the plane starts to move very fast as soon as APM2 gets a 3D fix. From that, I think the pin is not #7.
Any other clue of the right pin number?
static void update_NAV(void)
{
switch (g_gps->status()) {
case(2):
analogWrite(7, 100); //Turn NAV 7 LED on when gps has valid fix.
break;
case(1):
if (g_gps->valid_read == true){
NAV_light = !NAV_light; // Toggle light on and off to indicate gps messages being received, but no GPS fix lock
if (NAV_light){
analogWrite(7, 0);
} else {
analogWrite(7, 100);
}
}
break;
default:
analogWrite(7, 100);
break;
}
}

Hmm. I think I got confused by the terrible nomenclature of the analogWrite() function, which actually is supposed to be used on digital (not analog) pins. That said, this post suggests that the analog pins carry on numbering after the digital pins. And this post has a comparison table.
Bottom line: since there are 16 analog pins (0-15) and 54 digital pins (0-53), if the analog pins carry on after the digital ones, then analog 7 should be digital 61.
So try 61.
Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.24 members
51 members
133 members
1298 members
249 members
© 2013 Created by Chris Anderson.
Powered by
