Yeah I don't get what I'm doing wrong. The ProMini lights up but none of the leds do.
I'm using a sketch for the uno. I know I was trying to take the easy way out, but I thought at least one of them would light up.
Now I think I have it wired wrong, but I don't know how I possibly could. I did not write this sketch. I've never written anything for Arduino.
int ledPins[] = {2,3,4,5,6,7,8,9};
void setup()
{
int index;
for(index = 0; index <= 7; index++)
{
 pinMode(ledPins[index],OUTPUT);
 // ledPins[index] is replaced by the value in the array.
 // For example, ledPins[0] is 2
}
}
void loop()
{
// This loop() calls functions that we've written further below.
// We've disabled some of these by commenting them out (putting
// "//" in front of them). To try different LED displays, remove
// the "//" in front of the ones you'd like to run, and add "//"
// in front of those you don't to comment out (and disable) those
// lines.
oneAfterAnotherNoLoop();Â // Light up all the LEDs in turn
//oneAfterAnotherLoop();Â // Same as oneAfterAnotherNoLoop,
             // but with much less typing
//oneOnAtATime();Â Â Â Â // Turn on one LED at a time,
             // scrolling down the line
//pingPong();Â Â Â Â Â Â // Light the LEDs middle to the edges
//marquee();Â Â Â Â Â Â Â // Chase lights like you see on signs
//randomLED();Â Â Â Â Â Â // Blink LEDs randomly
}
/*
oneAfterAnotherNoLoop()
This function will light one LED, delay for delayTime, then light
the next LED, and repeat until all the LEDs are on. It will then
turn them off in the reverse order.
This function does NOT use a for() loop. We've done it the hard way
to show you how much easier life can be when you use for() loops.
Take a look at oneAfterAnotherLoop() further down, which does
exactly the same thing with much less typing.
*/
void oneAfterAnotherNoLoop()
{
int delayTime = 100; // time (milliseconds) to pause between LEDs
           // make this smaller for faster switching
// turn all the LEDs on:
digitalWrite(ledPins[0], HIGH);
delay(delayTime);Â Â Â Â Â Â Â Â
digitalWrite(ledPins[1], HIGH);
delay(delayTime);Â Â Â Â Â Â Â Â
delay(delayTime);Â Â Â Â Â Â Â
digitalWrite(ledPins[3], HIGH);
delay(delayTime);Â Â Â Â Â Â Â Â
digitalWrite(ledPins[4], HIGH):
delay(delayTime);Â Â Â Â Â Â Â Â
digitalWrite(ledPins[5], HIGH);
delay(delayTime);Â Â Â Â Â Â Â Â
digitalWrite(ledPins[6], HIGH);
delay(delayTime);Â Â Â Â Â Â Â
digitalWrite(ledPins[7], HIGH);Â
delay(delayTime);Â Â Â Â Â Â Â Â
// turn all the LEDs off:
digitalWrite(ledPins[7], LOW);Â //Turn off LED #7 (pin 9)
delay(delayTime);Â Â Â Â Â Â Â Â //wait delayTime milliseconds
digitalWrite(ledPins[6], LOW);Â //Turn off LED #6 (pin 8)
delay(delayTime);Â Â Â Â Â Â Â Â //wait delayTime milliseconds
digitalWrite(ledPins[5], LOW);Â //Turn off LED #5 (pin 7)
delay(delayTime);Â Â Â Â Â Â Â Â //wait delayTime milliseconds
digitalWrite(ledPins[4], LOW);Â //Turn off LED #4 (pin 6)
delay(delayTime);Â Â Â Â Â Â Â Â //wait delayTime milliseconds
digitalWrite(ledPins[3], LOW);Â //Turn off LED #3 (pin 5)
delay(delayTime);Â Â Â Â Â Â Â Â //wait delayTime milliseconds
digitalWrite(ledPins[2], LOW);Â //Turn off LED #2 (pin 4)
delay(delayTime);Â Â Â Â Â Â Â Â //wait delayTime milliseconds
digitalWrite(ledPins[1], LOW);Â //Turn off LED #1 (pin 3)
delay(delayTime);Â Â Â Â Â Â Â Â //wait delayTime milliseconds
digitalWrite(ledPins[0], LOW);Â //Turn off LED #0 (pin 2)
delay(delayTime);Â Â Â Â Â Â Â Â //wait delayTime millisecondsÂ
}
/*
oneAfterAnotherLoop()
This function does exactly the same thing as oneAfterAnotherNoLoop(),
but it takes advantage of for() loops and the array to do it with
much less typing.
*/
void oneAfterAnotherLoop()
{
int index;
int delayTime = 100; //
         Â
for(index = 0; index <= 7; index++)
{
 digitalWrite(ledPins[index], HIGH);
 delay(delayTime);       Â
}Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
for(index = 7; index >= 0; index--)
{
 digitalWrite(ledPins[index], LOW);
 delay(delayTime);
}Â Â Â Â Â Â Â
}
/*
oneOnAtATime()
This function will step through the LEDs,
lighting only one at at time.
*/
void oneOnAtATime()
{
int index;
int delayTime = 100; // milliseconds to pause between LEDs
           // make this smaller for faster switching
// step through the LEDs, from 0 to 7
for(index = 0; index <= 7; index++)
{
 digitalWrite(ledPins[index], HIGH); // turn LED on
 delay(delayTime);          // pause to slow down
 digitalWrite(ledPins[index], LOW); // turn LED off
}
}
/*
pingPong()
This function will step through the LEDs,
lighting one at at time in both directions.
*/
void pingPong()
{
int index;
int delayTime = 100; // milliseconds to pause between LEDs
           // make this smaller for faster switching
// step through the LEDs, from 0 to 7
for(index = 0; index <= 7; index++)
{
 digitalWrite(ledPins[index], HIGH); // turn LED on
 delay(delayTime);          // pause to slow down
 digitalWrite(ledPins[index], LOW); // turn LED off
}
// step through the LEDs, from 7 to 0
for(index = 7; index >= 0; index--)
{
 digitalWrite(ledPins[index], HIGH); // turn LED on
 delay(delayTime);          // pause to slow down
 digitalWrite(ledPins[index], LOW); // turn LED off
}
}
/*
marquee()
This function will mimic "chase lights" like those around signs.
*/
void marquee()
{
int index;
int delayTime = 200; // milliseconds to pause between LEDs
           // Make this smaller for faster switching
// Step through the first four LEDs
// (We'll light up one in the lower 4 and one in the upper 4)
for(index = 0; index <= 3; index++) // Step from 0 to 3
{
 digitalWrite(ledPins[index], HIGH);  // Turn a LED on
 digitalWrite(ledPins[index+4], HIGH); // Skip four, and turn that LED on
 delay(delayTime);           // Pause to slow down the sequence
 digitalWrite(ledPins[index], LOW);  // Turn the LED off
 digitalWrite(ledPins[index+4], LOW); // Skip four, and turn that LED off
}
}
/*
randomLED()
This function will turn on random LEDs. Can you modify it so it
also lights them for random times?
*/
void randomLED()
{
int index;
int delayTime;
index = random(8);Â Â // pick a random number between 0 and 7
delayTime = 100;
digitalWrite(ledPins[index], HIGH);Â // turn LED on
delay(delayTime);Â Â Â Â Â Â Â Â Â Â // pause to slow down
digitalWrite(ledPins[index], LOW);Â // turn LED off
}
Code To Note