diff --git a/OpenWatchWinder.ino b/OpenWatchWinder.ino index f50022fef25bdc4d720bac988287ebd8ab37edac..257e3e3e2b6982f84ff2b9b8b6a1b46ec2b4e710 100644 --- a/OpenWatchWinder.ino +++ b/OpenWatchWinder.ino @@ -5,7 +5,7 @@ using namespace ace_button; -#define ROTATIONS 1 +#define CYCLES 1 #define ROT_R 2 #define ROT_L 2 #define ROT_STEPS 4096 @@ -37,7 +37,7 @@ AceButton pwr_sw(SW_PIN); int TargetPos = 0; long StartTime = 0; -int Rotations = ROTATIONS; +int Rotations = CYCLES; StateType WState = W_INIT; int Restart = false; int Continue = false; @@ -84,7 +84,7 @@ void loop() } StartTime = millis(); winder.enableOutputs(); - Rotations = ROTATIONS; + Rotations = CYCLES; break; case W_CYCLE: diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..cb38fb460e27d0d86c3afaddeb5ccb10013533b4 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# Open Watch Winder + +This code allows you to control a stepper motor with a momentary switch button. + +## Using the Winder +On powerup, the LED will fade on an the winder will be in standby, waiting for a button press. + +The button knows two types of inputs: +* **press**, which is input shorter than 500ms +* **long-press**, which is input longer than 500ms + +The winder works in cycles, which means it will do the configured number of cycles (`CYCLES`), with each cycle consisting of a configured number of rotations in each direction (`ROT_R`, `ROT_L`), then wait for the +configured amount of minutes (`PAUSE_MIN`), and eventually restart the cycles. This will be refered to as "_winding_". + +In short: +* press the button to start winding +* long-press the button to stop winding + +### Switching Modes +* When pressing the button while the winder is in standby, it will start winding. +* When long-pressing the button while it is winding, it will return to the home position and stop winding. +* When long-pressing the button while it is waiting for the next cycle, it will stop winding. +* When pressing the buttong while it is waiting for the next cycle, it will start winding. + +## LED Status +* **Solid**: Standby +* **Blinking** (1s on, 0.5s off): Winding +* **Slow Breathing**: Waiting for next cycles +* **Fast Breathing**: Next cycle will start in <1 minute + +## Wiring Diagram + +<a href="https://git.faked.org/jan/openwatchwinder/raw/master/wiring.png"><img src="https://git.faked.org/jan/openwatchwinder/raw/master/wiring.png" alt="Wiring Diagram" width="500"/></a>