const int CLK = 2;
const int RESET = 3;
int count = 0;
int countLimit = 36;
// the setup function runs once when you press reset or power the board
void setup() {
pinMode(CLK, OUTPUT);
pinMode(RESET, OUTPUT);
digitalWrite(RESET, HIGH);
delay(100);
digitalWrite(RESET, LOW);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(CLK, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for 100 mS
digitalWrite(CLK, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for 100mS
count++;
if(count >= countLimit)
{
count = 0;
digitalWrite(RESET, HIGH);
delay(1000);
digitalWrite(RESET, LOW);
}
}
Once uploading is successful, counter will start counting from 0. When the count reaches “countLimit”, count will be reset to zero.
HaberOcean is the leading electronics store with wide variety of products your requirements for all your projects.
© Copyright 2023 HaberOcean - All rights reserved.