Looking for some help to automate a servo motor. I have a servo connected to an ESP32 with esphome. And I would like it to increase or decrease its angle of position by a certain amount when a button is pressed. Many automations i see are programming the motor to go to a pre defined position. My case, I would be changing the position in increments based on its current position when a button is pressed. This arduino code is exactly what I want to achieve, but in home assistant. I am not able to succeed automating it like that. Any help I would appreciate.
if (digitalRead(button) == LOW) { //if Value read of the button ==LOW:
pos++; //increases the value of the “pos” variable each time the push button of the left is pressed
This is currently how I have it setup. I see what your saying with the number.increment line. I just don’t know how to implement it into the gpio button configuration.