Mechanical counter

Mechanical counter

Description

This is a simple, easy to build, three digit mechanical counter. check out my you tube channel: https://www.youtube.com/channel/UCMgnEbAWquCmUA6PmnraRFQ/featured other things you need: -28BYJ-48 stepper Motor -10(1/8x3/4 machine screws) and two nuts -3/16 steel rod - 2 1/4 -3/16 steel rod - 2 3/4 note: there are two different number wheels two of them have pegs and one doesn't. make sure that the to plate in installed correctly. Assembly video: https://youtu.be/YPiHM70R6K8 follow video for instructions whatch the coding video: https://youtu.be/qc8h17euKeE example arduino code: //#include <Stepper.h> // make this line so its not a comment (sorry about this) Stepper myStepper = Stepper(2048, 5, 6,7,8); //fiest number is the steps for one rotation, next for is what the motor is connected to int curNum =0; int newNum = 0; void setup() { // put your setup code here, to run once: } void loop() { // put your main code here, to run repeatedly: //add your main code here. your code mustchange the newNum variable to change the number displayed by the mechanical counter newNum = constrain(newNum,0,999);//constrain the numbers between 0-999 (what the counter can display) myStepper.setSpeed(15); if (curNum < newNum){ myStepper.step(2040/10); curNum ++; delay(50); for(int i=0;i<1000;i=i+10){ if(curNum==(i)){ myStepper.step(8); } } } if (curNum > newNum){ myStepper.step(-2040/10); curNum --; delay(50); for(int i=0;i<1000;i=i+10){ if(curNum==(i)){ myStepper.step(-8); } } } }

Statistics

Likes

64

Downloads

0