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

DIY Robocars via Twitter
Jan 28
DIY Robocars via Twitter
RT @Heavy02011: ⁦@diyrobocars⁩ : A Home-brew computer club* for Connected Autonomous Driving. talk at #piandmore ⁦@PiAndMore⁩ on Jan 23rd h…
Jan 23
DIY Robocars via Twitter
RT @a1k0n: New blog post! Deep dive into my ceiling light based localization algorithm which runs in 1ms on a Raspberry Pi 3: https://t.co/…
Jan 23
DIY Robocars via Twitter
Great new guide to using @donkey_car https://custom-build-robots.com/donkey-car-e-book-en
Jan 23
DIY Robocars via Twitter
RT @chr1sa: The next @DIYRobocars virtual AI race is tomorrow morn at 9:00am PT. You can watch live on Twitch https://www.meetup.com/DIYRobocars/events/275268196/
Jan 22
DIY Robocars via Twitter
New version of Intel OpenBot! This resolves many of the issues with the first version, including a much smoother tr… https://twitter.com/i/web/status/1352395636369313798
Jan 21
DIY Drones via Twitter
Using ArduRover with an RTK GPS https://ift.tt/2N9I3RO
Jan 18
DIY Drones via Twitter
Jan 18
DIY Robocars via Twitter
Jan 18
DIY Robocars via Twitter
Jan 15
DIY Robocars via Twitter
Jan 15
DIY Drones via Twitter
Jan 14
DIY Robocars via Twitter
RT @Heavy02011: @diyrobocars : A Home-brew computer club* for Connected Autonomous Driving on Jan 23rd, 2021 https://www.meetup.com/Connected-Autonomous-Driving/events/275728684/ #Meetu…
Jan 14
DIY Robocars via Twitter
Jan 14
DIY Robocars via Twitter
RT @Heavy02011: ⁦@diyrobocars⁩ Autonomous Driving Assembly at #rC3. join us at https://rc3.world/rc3/assembly/diyrobocars-f1tenth/ ⁦@f1tenth⁩ ⁦@DAVGtech⁩ ⁦@DWalmroth⁩…
Jan 11
DIY Robocars via Twitter
RT @chr1sa: New car designs coming for our next @DIYRobocars @donkey_car virtual race on the 23rd. Choose any one you want at race time Le…
Jan 11
More…