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()

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

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!)

Views: 673


Reply to This

Replies to This Discussion

Pin 13 should work. You defined it as an output 3 times :-) I bet the other pins are just feeling left out :-)

oh my! i made an edit to my code and didn't reflect that in my post... the code on my board is

Hmm, well I re-uploaded the code to the board (no changes) but making sure to hit reset before and after uploading the code, and now OUT1 and OUT2 blink at the same rate as the STAT LED, but they do so out of phase. What have I done to my poor board? haha

a) Why do the OUT pins turn on when the STAT turns off and vice-a-versa?
b) Why is OUT1 turning on at all? I thought that was pin9? ( digitalWrite(9,HIGH) )
c) Why is OUT3 not turning on? I thought that was pin11?
Sounds like you're well on your way to mastering the fundamentals :-)

I was wondering if the pin numbers were correct, but I can't really look it it up right now. I'm sure you'll get it figured out.

You seem to be speaking Greek in terms of Arduino.

What is OUT1, OUT2 and OUT3? These are not standard Arduino terms. What Arduino do you have?

What does "a battery source applied to the 3rd input" mean? I assume you mean the PWR SEL jumper is on EXT not ESC. That would mean power goes to the barrel connector.

The pin numbers on a standard Arduino are marked on the board. Where are your LED's plugged in? They should be in Digital Out 10,11 and optionally 13 (or use the on-board LED for that).

I'd like to help, but I'm confused.
hmm, I should specify that I've got one of the 2nd batches of the ArduPilot board (picture in the attachment at top) which is marked up with identifiers like OUT1 and whatnot. Sorry for the confusion, does that picture help?
FWIW, there's certainly no problem with your program when running it on a Duemilanova board. Works just as expected. I'm sure the problem is confusion on just what pins go to the out1, 2, and 3 connectors. I took a quick look, but all I was able to determine was that it would take more than a quick look :-)

D6, D7, D8, D11, D12, D13 are the outs that correspond(-ish) to your code. For the life of me I can't find the pinout for OUT1, OUT2, OUT3 and OUT4. Looking at the code, it looks like OUT1 = Digital Pin 9 and OUT2 = Digital Pin 10.

Your out-of-sync phasing may have to do with the pinouts for OUTx. It seems logical that they might be inverted for controlling servos, but I don't know.

Docs would be nice. :)
Indeed D9 and D10 seem equivalent to OUT1 and OUT2 signal pins. That makes thus D8, D11, D12 and D13 available pins on board.
On a spare ArduPilot board, I use D8 for a photo shutter, D12 for a NewSoftSerial input (from the autopilot board) and D13 for another NewSoftSerial input (from the Xbee).
More info from a post by Michal:
Pins as used in ArduPilot on ATMega168:
d0 = serial IN Rx - used for serial communication
d1 = serial OUT Tx - ''
d2 = servo 1 IN
d3 = servo 2 IN
d4 = MUX IN (read pin from code to determine if autopilot is ON)
d5 = Mode IN (set by ATTiny45 if you have 3-state switch on RC transmitter for enabling autopilot, and it is centered), free for your own use
d6-d8, d11 = IN/OUT, free for your use
d9 = servo 1 OUT
d10 = servo 2 OUT
d12 = Lock LED
d13 = Stat LED
a0 - a5 = analog in pins, free for your use (can be used also as digital in/out)

ATTiny 45 is controlled by CTRL IN, and it just switches signal on servo OUT 1&2 pins either from servo IN 1&2 pins or from AT168 (autopilot) and sets MUX pin on AT168. So by servo signal on CTRL IN you enable or disable autopilot. Servo signal switching is done by multiplexer chip. MUX LED lights when autopilot is enabled. All the autopilot code is in AT168 chip.

It also helps to study ATMega 168 product sheet,
board PCB, ATtiny45 product sheet and multiplexer product sheet. You can learn from these what are actual pins on the chips, their connections, etc.
would you mind sharing a photo of what that looks like when you get a chance? The software side of Arduino seems pretty strait forward, but my experience is all software (flash, PHP) and little hardware. Did you solder a lead to the D8 thru-hole at the bottom of the board? A simple take a photo on a timer is what i'm looking to do.
thanks a million, that's a great place to start

Reply to Discussion


© 2020   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service