SCHEMATIC
PARTS USED
1.
Arduino UNO
2.
m-m wire
3.
Resistors
4.
LED
5.
Buzzer
6.
Bread Board
CODE
void setup() {
// put your setup code here, to run once:
pinMode(4,OUTPUT); //buzzer
pinMode(5,OUTPUT); //hour led
pinMode(6,OUTPUT); //minute led
pinMode(7,OUTPUT); //second led
}
void loop() {
// put your main code here, to run repeatedly:
int hour, minute, second, two, i=0; //initializtion
int imcount=0, ihcount=0, ibcount=0; //initialization
for(two=0;two<2;two++) //for statement for 12 hour time
{
for(hour=0;hour<12;hour++) //for statement for hour hand
{
ibcount++; //buzzer count increment
for(minute=0;minute<60;minute++) //for statement for minute hand
{
ihcount++; //hour count increment
for(second=0;second<60;second++) //for statement for second hand
{
imcount++; //minute count increment
digitalWrite(7,HIGH); //pinmode 7 high
if(imcount==59)
{
digitalWrite(6,HIGH); //pinmode 6 high
}
if(ihcount==59)
{
digitalWrite(5,HIGH); //pinmode 5 high
digitalWrite(4,HIGH); //pinmode 4 high
}
delay(500); //delay 0.5 seconds
digitalWrite(7,LOW); //pinmode 7 low
if(imcount==59)
{
digitalWrite(6,LOW); //pinmode 6 low
}
if(ihcount==59)
{
digitalWrite(5,LOW); //pinmode 5 low
digitalWrite(4,LOW); //pinmode 4 low
i++; //i increment
if(i==ibcount)
{
ihcount=0;
}
}
delay(500);
}
imcount=0;
}
}
ibcount=0;
}
}
PARTS USED
1.
Arduino UNO
2.
m-m wire
3.
Resistors
4.
LED
5.
Buzzer
6.
Bread Board
CODE
void setup() {
// put your setup code here, to run once:
pinMode(4,OUTPUT); //buzzer
pinMode(5,OUTPUT); //hour led
pinMode(6,OUTPUT); //minute led
pinMode(7,OUTPUT); //second led
}
void loop() {
// put your main code here, to run repeatedly:
int hour, minute, second, two, i=0; //initializtion
int imcount=0, ihcount=0, ibcount=0; //initialization
for(two=0;two<2;two++) //for statement for 12 hour time
{
for(hour=0;hour<12;hour++) //for statement for hour hand
{
ibcount++; //buzzer count increment
for(minute=0;minute<60;minute++) //for statement for minute hand
{
ihcount++; //hour count increment
for(second=0;second<60;second++) //for statement for second hand
{
imcount++; //minute count increment
digitalWrite(7,HIGH); //pinmode 7 high
if(imcount==59)
{
digitalWrite(6,HIGH); //pinmode 6 high
}
if(ihcount==59)
{
digitalWrite(5,HIGH); //pinmode 5 high
digitalWrite(4,HIGH); //pinmode 4 high
}
delay(500); //delay 0.5 seconds
digitalWrite(7,LOW); //pinmode 7 low
if(imcount==59)
{
digitalWrite(6,LOW); //pinmode 6 low
}
if(ihcount==59)
{
digitalWrite(5,LOW); //pinmode 5 low
digitalWrite(4,LOW); //pinmode 4 low
i++; //i increment
if(i==ibcount)
{
ihcount=0;
}
}
delay(500);
}
imcount=0;
}
}
ibcount=0;
}
}
No comments:
Post a Comment