I am using a stepper motor, create a twinkle effect for my fiber optic star ceiling, I need to set the stepper to run indefinitely until I stop it. Can you help please.
enable loop is a input_boolean in HA hat enables the loop. loop_duration is an input_number in HA that adjusts the length of the loop. To bring the values in from HA.
You’ll need to define the steps the motor takes in an automation in order to get the effect you want. Steppers don’t have an infinite movement as far as I can see. You define x amount of steps then it stops.
You’ll need a way to restart the action when it finishes. That’s where a loop could restart the script. So possibly
binary_sensor:
- platform: template
name: "Loop template"
id: loop_template
lambda: |-
if (id(enable_loop)) {
return true;
} else {
return false;
}
on_state:
- while:
condition:
binary_sensor.is_on: loop_template
then:
- script.execute: twinkle_script
- script.wait: twinkle_script
### I am not sure that this will wait for the motor to complete it's steps
### Might need to use a delay instead.
Then create an input_boolean in HA named enable loop[ and then added to esphome
I work on a BBQ skewer,
would someone help me with the code so that the bbq skewer runs in the loop?
…what I still need for automation is a switch to stop.
I fount that it’s much easier to work with a 3d printer stepper driver ie. A4988, but any step/direction controlled stepper driver should, use the led output as the step command for the stepper, the frequency should set the speed off the motor, set the enable and direction pins as switches .