You will need to print the standard part of the 7 Segment Mechanical Counter.
You also can use tigh tolerences part from my previous remix.
You need the backplate and the push action from this model.
Tips: Print the push action on it's side with tupport to have smooth surfaces.
This model is optimized for a mg995 servo
I've used this horn for the servo.
The code that follow is for an ESP32 but you are free to use what you want.
I've based the servo control from this video.
// Import ESP32Servo library, don't forget to install it. https://madhephaestus.github.io/ESP32Servo/annotated.html
#include <ESP32Servo.h>
// Initiate the variables
Servo myServo;
int count = 0;
int wantedCount = 0;
// Setup servo and serial communication
void setup() {
myServo.attach(13);
Serial.begin(115200);
}
void loop() {
nextDigit();
}
// Function making the servo go down, then go up
void nextDigit() {
myServo.write(100);
delay(500);
myServo.write(170);
delay(500);
}
// Import ESP32Servo library, don't forget to install it. https://madhephaestus.github.io/ESP32Servo/annotated.html
#include <ESP32Servo.h>
// Initiate the variables
Servo myServo;
int count = 0;
int wantedCount = 0;
// Setup servo and serial communication
void setup() {
myServo.attach(13);
Serial.begin(115200);
}
void loop() {
// Read the integer value from serial input, make sure to input a number between 0 and 9
if (Serial.available() > 0) {
wantedCount = Serial.parseInt();
}
// Move the servo until the count matches the wantedCount
while (count != wantedCount) {
// Trigger the servo
nextDigit();
count++;
// Loop back to 0 when hiting 10
if (count == 10) {
count = 0;
}
Serial.println("wanted: " + String(wantedCount));
Serial.println("current: " + String(count));
}
}
// Function making the servo go down, then go up
void nextDigit() {
myServo.write(100);
delay(500);
myServo.write(170);
delay(500);
}
The author remixed this model.
I've modified the back plate in order to be able to attach a mg995 servo.
I've also added an arm to the push action in order for the servo to push on it