Simple Arduino Programming Question

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

ardu_led.jpg

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

Join diydrones

Email me when people reply –

Replies

  • 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. :)
  • 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, 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?
  • Pin 13 should work. You defined it as an output 3 times :-) I bet the other pins are just feeling left out :-)

    Rusty
This reply was deleted.

Activity

David Hori liked Isabella Domi's profile
Jan 12
More…