Hello my friends
This is what Ive got written and it seems okay to me but I think there are quite a few noob mistakes. Please help me edit so it is compiled correctly.
and how how can i do it so if led (12) high and button 2 is pressed(high) to change the delay time in the led pinarray. This seemed the most logical but I dont know if it will work Im sure there another way. This code setup is as follows:
if((buttonPin2State== HIGH) && (digitalRead(ledPin12) == HIGH))
}
for (count=0;count<11;count++ )
{
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer);
}
else if ((buttonPin2State== HIGH) && (digitalRead(ledPin13) == HIGH))
This is what Ive got written and it seems okay to me but I think there are quite a few noob mistakes. Please help me edit so it is compiled correctly.
Rich (BB code):
const int ledPin1 = 3;
const int ledPin2 = 4;
const int ledPin3 = 5;
const int ledPin4 = 6;
const int ledPin5 = 7;
const int ledPin6 = 8;
const int ledPin7= 9;
const int ledPin8 = 10;
const int ledPin9 = 11;
const int ledPin10 = 12;
const int ledPin11 = 13;
const int ledPin12 = 14;
const int ledPin13 = 15;
const int ledPin14 = 16;
const int ledPin15 = 17;
const int buttonPin1 = 1;
const int buttonPin2 = 2;
int pinArray[] = {
3, 4, 5, 6, 7,8,9,10,11,12,13};
int count = 0;
int timer = 1000;
int buttonPin1State = 0;
int buttonPin2State = 0;
void setup()
{
pinMode(pinArray[count], OUTPUT);
pinMode(buttonPin2, INPUT);
}
void loop()
{
for (count=0;count<11;count++)
{
buttonPin1State = digitalRead(buttonPin1);
if (buttonPin1State == HIGH)
delay(timer*4);
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer*2);
}
for (count=0;count<11;count++)
{
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer*2);
}
for (count=0;count<11;count++)
{
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer*2);
{
{
digitalWrite(ledPin12, HIGH);
delay(2000);
digitalWrite(ledPin13, HIGH);
delay(2000);
digitalWrite(ledPin14, HIGH);
delay(2000);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin14, LOW);
delay(6000);
}
{
buttonPin2State = digitalRead(buttonPin2);
if((buttonPin2State== HIGH) && (digitalRead(ledPin12) == HIGH))
}
for (count=0;count<11;count++ )
{
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer);
}
else if ((buttonPin2State== HIGH) && (digitalRead(ledPin13) == HIGH))
}
for (count=0;count<11;count++)
{
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(500);
}
else((buttonPin2State== HIGH) && (digitalRead(ledPin14) == HIGH))
}
for (count=0;count<11;count++)
{
digitalWrite(pinArray[count], HIGH);
delay(500);
digitalWrite(pinArray[count], LOW);
delay(0);
}
}
if((buttonPin2State== HIGH) && (digitalRead(ledPin12) == HIGH))
}
for (count=0;count<11;count++ )
{
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer);
}
else if ((buttonPin2State== HIGH) && (digitalRead(ledPin13) == HIGH))