sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
Other
230 stars 124 forks source link

Button to turn on a RGB strip light #394

Closed Tharos88 closed 2 months ago

Tharos88 commented 2 months ago

Hi. I'd like know how can I get to add a touch button to turn on and turn off the RGB strip lights and what the code would be like in Arduino. Thank you.

sivar2311 commented 2 months ago

Unfortunately, your question is very general and can therefore only be answered in general terms.

Write a function that periodically checks the status of the button. If the status changes and the current status is “pressed”, switch the strip on or off (depending on the status of the RGB strip). At the same time, send an onPowerState event to the SinricPro server to inform it of the changed status.

See the handleButtonPress function in the example Switch.ino

as well as the control of an LED strip in the examples Light_FastLED_WS2812.ino and RGB_LED_Stripe_5050.ino

Tharos88 commented 2 months ago

Thanks for your quick response @sivar2311. I think it will be enough for me to implement the button. Thank you so much.