Go Down

Topic: Leonardo Question (Read 886 times) previous topic - next topic

jeffd


johnwasser

The question in the video is:

"LEDs are connected to most of the Arduino Leonardo pins. When I power up or reset some of the LEDs pulse for a few seconds (reportedly something the bootloader does).  Can I get rid of that and have it go straight to my sketch?  If so, how?"

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

James C4S

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

jeffd

Sorry, I thought posting a video would help facilitate the process, guess not. Thanks for posting the summary though, I really need to figure this out. I don't have a schematic but its really simple, just LEDS connected to pwm pins that fade on in succession. Here is the code I'm using:

Code: [Select]



int leds[] = {
  3,5,6,9,10,11,13};
int num = 7;


void init_leds(){
  for(int i = 0; i<num; i++){
    digitalWrite(leds[i],LOW);
    pinMode(leds[i], OUTPUT);     
  }
}

void FadeOutLeds(){
  for(int i = 155;i>0;i--){

    for(int j = 0;j<num;j++){
      analogWrite(leds[j],i);
    }
    delay(80);
  }

}

void FadeInLed(int theLed){
  for(int i = 0;i<256;i++){
    analogWrite(theLed,i);
    delay(20);
  }
}


void setup() {               
  // initialize the digital pins as an output.
  init_leds();
}

// the loop routine runs over and over again forever:
void loop() {

  for(int i = 0; i<num;i++){
    FadeInLed(leds[i]);     
  }
  delay(5000);               // wait for 5 seconds
  FadeOutLeds();
  delay(5000); 
}



Im not certain a schematic would help anyway. Im not sure theres technically anything wrong, from what I've read about the Leonardo the bootloader takes 8 seconds to run which is exactly how long the first LEDs pulse for. I just need to know if theres a way to make them stop and have my project begin right away vs. having to wait 8 seconds before the above code is executed.

frank26080115

Modify the bootloader, or use an ISP programmer for all future programming.
Freelance engineer, consultant, contractor. Graduated from UW in 2013.

Go Up