7 arrays with 7 groups of led, for timer project on digital pins as out puts

need help in this as im completely new, to programming, besides making a count down program in basic, but was years ago.
basically im trying to make several groups of leds turn off in a set order or count up having trouble trying to figure out wear to start.

had some fun modifying the night rider program
wanted to use a cupple buttons to one pause and resume, and start the count, and two add time by holding a another button in or pressing it repeatedly till the desired amount is light, by doing this its helping me learn more, so i can understand the coding side of things, and most likely build more fun things
so need help in this

so far the array sequance is this array 1 is 3 seconds 3 led, array 2 is27 seconds and 27 leds, array 3 1 led for 30 sec, array 4 3 led 3 min, array 5 3 led each being 3 min,array 6 is3 led each being 9 min, and array 7 1 led 30 min, for a grand total of time i think max of 1 hour and 4 min

Sorry, I'm a bit stupid and don't understand anything in your writing :frowning:

What is "array"? Is it an arrangement of a couple of LED, which should be turned on or off altogether? Arrays in code are something quite different.

Can you translate your requirements into signals going in and out of an Arduino?

the array, are outputs look in to the night rider program, ill give an example hear.... first off the link to the example http://www.arduino.cc/en/Tutorial/KnightRider, and the modified array im using....

int pinArray[] = {21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,}; //this is jest a small example of the pins im using the leds on
int count = 0;
int timer = 100;
//pins add one above and below the number of pins in use as a null in the sequence unless you run out of places for pins,
void setup(){
// we make all the declarations at once
for (count=0;count<12;count++) {
pinMode(pinArray[count], OUTPUT);

hope this may clear a little bit of things up, ill try to reconstruct my program that i have so far, it got wiped by mistake

the basic idea is im only using the digital pins on the mega, to control the leds on /off state, will be using transistors in the mix to provide the leds with the power thay need,

i guess the q is can one use say 7 different pin array groups, at the same time

So like this? (use byte, not int - all values are <255, yes?

byte pinArray0[] = {21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray1[] = {19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray2[] = {17, 18, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray3[] = {15, 16, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray4[] = {13, 14, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray5[] = {11,12, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray6[] = {9, 10 , 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

with minor changes between arrays?
Yes, you can do that.

cool, thank you CrossRoads lots,yes as the led groups are ether on, full or off full, now can thay be given a set value say for instance array 1 pins 1, 2, 3 are all 1 second the next array, each led is worth 3 seconds and so on is this possible?
and to set it up if i wear to press a button it rapidly count up, and then press a nother button to tell it to start counting down like a timer or pause it, i did see a toggle command, but wondering if it was possible?
i know ill have to use some if, array1 = 3 then array2 ++

im planing on using up as many of the available pins, but very few add on parts , transistors the exception

Hi, not sure what you need transistors for, unless you are planning to multiplex the leds.

This may make wiring up your project much easier.

Paul

darkhiss:
can thay be given a set value say for instance array 1 pins 1, 2, 3 are all 1 second the next array, each led is worth 3 seconds and so on is this possible?
and to set it up if i wear to press a button it rapidly count up, and then press a nother button to tell it to start counting down like a timer or pause it, i did see a toggle command, but wondering if it was possible?

It's all possible. But don't tell us, tell your Arduino what to do.

PaulRB:
Hi, not sure what you need transistors for, unless you are planning to multiplex the leds.

This may make wiring up your project much easier.

Paul

well the board can only out put so mutch current to the io pins, and i dont want to use a shift register, as it be more a complicated head ack to me, the led inputs are directly coming from the io whale the grounds are the common, the transister jest allows me to bring the led back to the battery, so thay get the right amout of curent, instead of getting it only from the board

Do you already have a plan (circuit diagram), how you want to wire the LEDs and transistors to the power source and to the Arduino?

darkhiss:
well the board can only out put so mutch current to the io pins, and i dont want to use a shift register, as it be more a complicated head ack to me, the led inputs are directly coming from the io whale the grounds are the common, the transister jest allows me to bring the led back to the battery, so thay get the right amout of curent, instead of getting it only from the board

What is the "right" amount of current? I still don't think you need transistors, although I can't be sure until you post a schematic for us to see.

With 49 leds directly connected from io ports to ground, I assume you are using a Mega. The 2560 chip can source or sink 800mA, so you could probably allow 10mA per led without overloading the 2560 or any of its ports.

yes it is the mega2560,i dont have a skim yet, still trying to bang out the test code using only 11 leds, with common ground and a 100 ohm resister, or a 220 resister, leds are on pins green > 22 to 30 and red> 52 and 53, no buttons for stating/pausing, or selecting time yet, tackling the minimum basics curently, when i have time , doing a long work shift,

how ever doing a test with the night rider program keeping all the leds on then slowly turning them off , showed that they all got dimmer with the next led in sequence when in the turn on phase, ill hash out a quick skim that connects to the board soon

any how hears the curent code to see what im working with so far, ill be posting an up date if i manage to figure out the bites in sted of the int that crossroads has presented, ill be trying to jest work with 2 segments for now

// edited for testing by darkhiss, for new timer display, using knight rider 2 as the base

int pinArray[] = {22, 23, 24, 25, 26, 27, 28, 29, 30, 52, 53}; //using digital pins for the led
int count = 0;
int timer = 1000; //delay of 1 second

void setup(){
// we make all the declarations at once
for (count=0;count<11;count++) {
pinMode(pinArray[count], OUTPUT);
}
}

void loop() {
for (count=0;count<11;count++) {
digitalWrite(pinArray[count], HIGH);// on phase
delay(timer);

}
for (count=11;count>=0;count--) {
digitalWrite(pinArray[count], LOW); // off phase
delay(timer);
}
}

hears the current set up

1431856437019[1].jpg

Its hard to be certain because your pic was so blurry, but I think I see the problem:

You have only one resistor. You should have one per led.

The only time you can get away with one resistor shared between leds is when you can guarantee that only one led will be lit at any instant.

If you share a resistor between more than one led and then light more than one led at once, they will dim. This is not a problem with power supply, its just Ohm's law.

PaulRB:
Its hard to be certain because your pic was so blurry, but I think I see the problem:

You have only one resistor. You should have one per led.

The only time you can get away with one resistor shared between leds is when you can guarantee that only one led will be lit at any instant.

If you share a resistor between more than one led and then light more than one led at once, they will dim. This is not a problem with power supply, its just Ohm's law.

thank you PaulRB, now is it ok jest to remove the resister, and jest use the leds directly, as i dont want to kill the pins,

CrossRoads:
So like this? (use byte, not int - all values are <255, yes?

byte pinArray0[] = {21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray1[] = {19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray2[] = {17, 18, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray3[] = {15, 16, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray4[] = {13, 14, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray5[] = {11,12, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

byte pinArray6[] = {9, 10 , 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,};

with minor changes between arrays?
Yes, you can do that.

thank you CrossRoads, ill be trying to see if i can properly use this code, example using my test set up, not shure, how to realy plug this in tho , hears what i have so far

byte pinArray0[] = {22, 23, 24, 25, 26, 27, 28, 29, 30,};

byte pinArray1[] = {52, 53,};
int count = 0;
int timer = 1000;

void setup(){
// we make all the declarations at once
for (count=0;count<12;count++) {
pinMode(pinArray0[count], OUTPUT);
pinMode(pinArray1[count], OUTPUT);
}
}

void loop() {
for (count=0;count<9;count++) {
digitalWrite(pinArray0[count], HIGH);
delay(timer);
if (pinarray0 == 9)
{
pinarray1 (count=0;count<2;count++)
}
}
for (count=5;count>=0;count--) {
digitalWrite(pinArray[count], LOW);
delay(timer);
}
}

ill be tryng this out see what happens, as it is im so new to this programming its sad

saddly im missing something

byte PinArray0[] = {22, 23, 24, 25, 26, 27, 28, 29, 30,};
byte PinArray1[] = {52, 53,};
byte count = 0;
int timer = 1000;

void setup(){
// we make all the declarations at once
for (count=0;count<9;count++) {
pinMode(PinArray0[count], OUTPUT);
pinMode(PinArray1[count], OUTPUT);
}
}

void loop() {
for (count=0;count<9;count++) {
digitalWrite(PinArray0[count], HIGH);
delay(timer);
if (PinArray0[count]==9);
{
PinArray1 (count=0;count<2;count++);
}
}
for (count=9;count>=0;count--) {
digitalWrite(PinArray0[count], LOW);
delay(timer);
}
}

i feel im close, but cant seem to correct it,

byte PinArray0[] = {22, 23, 24, 25, 26, 27, 28, 29, 30,};
byte PinArray1[] = {52, 53,};
byte count = 0;
int timer = 1000;

void setup(){
// we make all the declarations at once
for (count=0;count<9;count++) {
pinMode(PinArray0[count], OUTPUT);

}
}

void loop() {
for (count=0;count<10;count++) {
digitalWrite(PinArray0[count], HIGH);
delay(timer);
if (PinArray0[count == 10]);
{
digitalWrite(PinArray1[count], HIGH);

}
}

for (count=10;count>=0;count--) {
digitalWrite(PinArray0[count], LOW);
delay(timer);
}
}

problym might be the if part

thank you PaulRB, now is it ok jest to remove the resister, and jest use the leds directly, as i dont want to kill the pins,

No. If you don't want to kill the pins, or kill the leds, you must use one series resistor per led, like I said before.