Hey guys!

So I am trying to do some very basic arduino programming to master the fundamentals, and something is not working as I expected it to. My board is set up with the PSEL in ESC powere'd mode, and I have a battery source applied to the 3rd input for the time being, and instead of servos, I have LED's hooked up to the 3 output sets. Here is the code:

void setup()
{
pinMode(13,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
}

void loop(){
digitalWrite(13, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
delay(500);
digitalWrite(13, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
delay(500);
}

Pin 13 (the board's STAT LED) functions as expected, blinking on and off every second, but OUT2 and OUT3 are solidly lit, no blinking. Why is that? Are they somehow set to PWM by default or something that produces unexpected results? On top of that... the OUT LED's will just turn off after a minute or so, and then not come back on even after a reset, what's up with that? Is there something in frimware that i'm not aware of? (it does the same thing with the jumper across CTRL removed too)

(thanks for the note 13brv3!)

Tags: arduino

Views: 377

Attachments:

Reply to This

Replies to This Discussion

thanks a million, that's a great place to start
Guys, you've got to refer to the schematic to correspond Arduino pins to ArduPilot-specific nomenclature. It's all there.
Chris, good you link to the schematic here, but as a newbie i am sorry to admit I do not know how I could for example infer from them that ArduPilot servo OUT1 is accessed by programming the D9 pin in the Arduino environment. The 74LS157D "blackbox" in between makes it difficult (if not impossible) to relate the ATmega168 to the OUT pins. You say it's all there, but I couldn't find that connection, although it's probably there. Because of my lack of schematic reading knowledge, I think Michal's overview listing is very usefull.
It's pretty straightforward. Look at the schematic and you'll see that

S1B (which goes to pin 13 on the Atmega) -> Out 1
S2B (pin 14) -> Out 2

Then go to the Arduino pin mapping diagram to see how those physical pins related to Arduino's logical pins. Pin 13 = Digital 9.

It takes a while to learn how to read schematics, but it's worth doing. These are skills that you'll use again!
Ah, thanks for explaining that, it makes alot more sense now. Seeing that i only need an on/off switch, not a PWM'd servo switch, i'll just jump off of one of the other, unused digital pins. Thanks!
Thanks for all that explanation, Chris. It was not immediately obvious to me, in this part of the ArduPilot diagram around the 74LS157D chip, that S1B (pin3) is to be interpreted as an input which is linked in the chip to 1Y (pin4) output, itself linked to OUT1. But maybe I'm quite lonely finding this not so self-explaining. If this interpretation is right, then I learned again.
A multiplexer (MUX) takes eight inputs in A/B form and switches between them for the output. So S1A and S1B refer to RC vs Autopilot, and the MUX (directed by the Attiny) decides which one gets to control Out 1.
Thank for this add-on. Now I can imagine a little better how the MUX circuit works in the wires.

RSS

© 2014   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service