Hello all,
I am new to ESPhome and YAML code.
I created a smart light with a WS2812 ledstrip and a stepper motor to rotate the light.
The led and stepper works from HA but i want to optimize things. The problem is with the stepper. In the stepper component it seems that it is based to always drive to a target posistion, but i want to start and stop with a button and drive a certain continously speed with a slider from HA. Can someone help me with this and point in the wright direction how to set this up in the ESP config file?
Hello,
I was thinking maybe it is usefull for someone else to see the solution for this.
I finaly end up dont using the stepper component at all.
Start/stop and changing direction is done using switch component, and for the steps i used the Ledc PWM component.
captive_portal:
light:
- platform: esp32_rmt_led_strip
rgb_order: GRB
pin: 0
num_leds: 19
rmt_channel: 0
chipset: ws2812
name: "My Light"
number:
- platform: template
name: Rotatie snelheid
optimistic: true
min_value: 0
max_value: 600
step: 1
mode: slider
on_value:
then:
- output.ledc.set_frequency:
id: stepper_step
frequency: !lambda "return x;"
output:
- platform: ledc
pin: 7
id: stepper_step
max_power: 50%
switch:
- platform: gpio
pin:
number: 2
inverted: true
id: stepper_en
name: "Rotatie"
on_turn_on:
then:
- output.turn_on: stepper_step
on_turn_off:
then:
- output.turn_off: stepper_step
- platform: gpio
pin:
number: 6
inverted: true
id: stepper_dir
name: "Richting"
1 Like