The following are the sketches and final prototype for my time piece. ive also included the code at the bottom.
The follwing is my code :
int redMinutes[] = {2,3,4};
int blueHours[] = {5,6,7};
int greenLed[] = {8,9};
boolean isGreenOn = false;
boolean isBlueOn = false;
boolean isRedOn = false;
int blueCounter = 0;
int greenCounter = 0;
void setup()
{
int i = 0;
for (i = 0;i<3 ;i++){
pinMode(redMinutes[i], OUTPUT);
pinMode(blueHours[i], OUTPUT);
}
pinMode(greenLed[0], OUTPUT);
pinMode(greenLed[1], OUTPUT);
}
void loop(){
int i = 0;
if (isRedOn == false)
for (i = 0;i<3 ;i++){
digitalWrite(redMinutes[i], HIGH);isRedOn = true;}
else
for (i = 0;i<3 ;i++){
digitalWrite(redMinutes[i], LOW);isRedOn = false;}
delay(1000);
blueCounter++;
greenCounter++;
if ( blueCounter == 59){
if (isBlueOn == false)
for (i = 0;i<3 ;i++){
digitalWrite(blueHours[i], HIGH);isBlueOn = true;}
else
for (i = 0;i<3 ;i++){
digitalWrite(blueHours[i], LOW);isBlueOn = false;}
blueCounter = 0;
}
if ( greenCounter == 360){
if (isGreenOn == false)
for (i = 0;i<3 ;i++){
digitalWrite(greenLed[i], HIGH);isGreenOn = true;}
else
for (i = 0;i<3 ;i++){
digitalWrite(greenLed[i], LOW);isGreenOn = false;}
greenCounter = 0;
}
}