I hope I've just done something stupid

Questions and Discussion concerning the Bare Bones Board
Post Reply
thedavidfactor
Posts: 2
Joined: Tue Jul 05, 2011 10:28 pm

I hope I've just done something stupid

Post by thedavidfactor » Tue Jul 05, 2011 10:40 pm

I purchased an assembled and tested BBB ('cause I'm lazy, well actually 'cause I wanted to start playing as soon as it arrived). I've got a couple of LEDs and resistors and a breadboard. My Arduino software is running on a Laptop running Fedora 14 and I'm using a FTDI cable. I decided to start with the blink sketch (why not, right? ;) ) and my LED didn't blink. So I added a second LED to pin 12 and started experimenting. It seems like the 328 is locking up after about +/- 500 milliseconds. I'm running the following code:

Code: Select all

void setup() {
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
}

void loop() {
  for(int i=1; i<10; i++) {
    digitalWrite(12, HIGH);
    delay(100);
    digitalWrite(12, LOW);
    delay(100);
    digitalWrite(13, HIGH);
    delay(100);
    digitalWrite(13, LOW);
    delay(100);
    digitalWrite(12, HIGH);
    delay(100);
    digitalWrite(12, LOW);
    delay(100);
  }
}
I added the for loop because I thought maybe the void loop wasn't getting called repeatedly, anyway I get one blink of each LED and then pin 12 stays high and it stops blinking, if I play with the delay I can get it to stop at different points in the code, but I can't decrease the delay much below 100 and still see it.

Is there anything I can do to make sure I haven't done something stupid? The code uploads without any errors, if I reset the BBB I get the same behavior, I don't know what else to try, I've searched this forum and the arduino forum and haven't found any similar issues.

floresta
Posts: 93
Joined: Mon Jul 28, 2008 6:52 pm
Location: Western New York, USA
Contact:

Re: I hope I've just done something stupid

Post by floresta » Wed Jul 06, 2011 9:00 am

Try increasing the delay to 1000 and I think everything will look OK. Right now your LED is switching every 100 mS (1/10 sec) so to your eye it always appears 'on'. If you compare what you see to an LED that is actually on all the time yours will actually appear dimmer.

Don

thedavidfactor
Posts: 2
Joined: Tue Jul 05, 2011 10:28 pm

Re: I hope I've just done something stupid

Post by thedavidfactor » Wed Jul 06, 2011 9:05 am

if I increase the delay to 1000 milliseconds it just freezes with one on and one off. Right now it does as I describe, a very quick flicker between the two and then one stays on. If it was too short a delay, they both would appear to be "on". The "freeze" at 1000 milliseconds is what lead me to start experimenting with shorter delays to find a time period which would work.

paul
Site Admin
Posts: 735
Joined: Mon May 12, 2008 4:19 pm

Re: I hope I've just done something stupid

Post by paul » Thu Jul 07, 2011 10:20 am

thedavidfactor,


I'm baffled by the behavior (works with short delays but not long).

Are you using Duemianove setting in boards menu?
Try switching pins and report back behavior.

Paul

Post Reply