/*
The potentiometer controls the servo from 0 to 180 degrees and the current angle is
shown on the TM1637 display.
*/
#include <Servo.h>
#include <TM1637Display.h>
const int CLK = 2;
const int DIO = 3;
const int POT = A0;
int potVal = 0;
TM1637Display tm(2, 3);
Servo myServo;
int pos = 0;
void setup() {
myServo.attach(9);
Serial.begin(9600);
tm.setBrightness(7);
}
void loop() {
potVal = analogRead(POT);
potVal = map(potVal, 0,1023,0, 180);
tm.showNumberDec(potVal);
myServo.write(potVal);
}