0-9999 UP counter with RESET from Arduino UNO

Circuit is done as shown in the diagram. Upload the following program to Arduino UNO.

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);
  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

  if(count >= countLimit)
    count = 0;
    digitalWrite(RESET, HIGH);
    digitalWrite(RESET, LOW);

Once uploading successful, counter will start counting from 0. When the count reaches “countLimit”, count will be reset to zero.

Published by

Leave a Reply