Skip to content

Instantly share code, notes, and snippets.

@buildcircuit
Last active June 30, 2020 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buildcircuit/63256e74cc3760a33b619573a2235d28 to your computer and use it in GitHub Desktop.
Save buildcircuit/63256e74cc3760a33b619573a2235d28 to your computer and use it in GitHub Desktop.
CD4029 up and down counter
// Basic test of CD4029 up and down counter module
// Module designed by Sagar Sapkota from www.buildcircuit.net
void setup() {
pinMode(13, OUTPUT);// Connect pin 13 to CLK pinl
pinMode(12,OUTPUT); // Connect pin 12 to UD
//RESET THE COUNTER
// Connect Pin 11 of Arduino to RST Pin
pinMode(11,OUTPUT);
digitalWrite(11,HIGH);
delay(100);
digitalWrite(11,LOW);
}
// the loop function runs over and over again forever
void loop() {
for (int i=0;i<10;i++)
{
digitalWrite (12,HIGH); // Keeping pin 12 HIGH or UD pin HIGH will make the counter count UP
digitalWrite(13, HIGH); //Pulse high to CLK pin of CD4029
delay(500); // wait
digitalWrite(13, LOW); // pulse low
delay(500);
}
for (int j=0;j<10;j++)
{
digitalWrite (12,LOW); // Keeping pin 12 LOW or UD pin LOW will make the counter count DOWN
digitalWrite(13, HIGH); //Pulse high
delay(500); // wait
digitalWrite(13, LOW); // pulse low
delay(500);
}
}
@buildcircuit
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment