Combine actuator sketch with a sensor sketch (controlling blinds + reporting light level)
-
Hi all
What is the best way to combine an actuator sketch with an sensor when I want the sensor to report only occasionally and not in every loop?
I've built a servo actuator (modified sketch due to an override button), and I want to add a light-sensor (BHI750) to make my blinds report the lux from the outside so that my controller can decide whether to open or close the blinds.
-
One simple way is just to check millis() versus the last time you sent sensor data. If it's greater than the time you want to report, then read the sensor and send the information.
-
ah, thanks
But now I've got a new challenge:
I've made my sensor/actuator listen for commands (dimmer->servoposition) and send a light-level value every X seconds.However, the lux value is now received as subtype DIMMMER, even if the sketch declares a presentation for subtype LIGHT_LEVEL at startup.
My sketch also contains a button for servo control (if i press it shortly, it'll toggle 0/100 and if i hold it, it'll "dim" the servo until i release the button).
Any ideas on how to separate these two childs? - I've ofcourse defined one child value each for the servo and the light-sensor.
-
Figured it out!
Note to self: remember to make sure that each child has its own msg()
-
Been trying to combine servo and light sensor, but running into a few kinks with the sketch. Any chance you could post your finished work? Thanks in advance.
-Patrick
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
Home Assistant/MySensors quirks
Development • 17 Mar 2025, 02:35 • OldSurferDude 17 Mar 2025, 02:35 -
PJON and Minicore not working
Development • 28 days ago • Trand 28 days ago -
Radio waking up for no reason.
Development • 4 Jul 2020, 21:09 • Sasquatch 15 Jan 2025, 08:33 -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14 -
MQTT-Help me understand about the MQTT Gateway.
Development • 2 Mar 2025, 01:44 • dpcons 12 Mar 2025, 23:39