Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Combine actuator sketch with a sensor sketch (controlling blinds + reporting light level)

Combine actuator sketch with a sensor sketch (controlling blinds + reporting light level)

Scheduled Pinned Locked Moved Development
5 Posts 3 Posters 2.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • espenfE Offline
    espenfE Offline
    espenf
    wrote on last edited by espenf
    #1

    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.

    1 Reply Last reply
    0
    • TD22057T Offline
      TD22057T Offline
      TD22057
      Hardware Contributor
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • espenfE Offline
        espenfE Offline
        espenf
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • espenfE Offline
          espenfE Offline
          espenf
          wrote on last edited by
          #4

          Figured it out! :)
          Note to self: remember to make sure that each child has its own msg() :abc: :)

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Patrick Carney
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            18

            Online

            11.7k

            Users

            11.2k

            Topics

            113.1k

            Posts


            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • MySensors
            • OpenHardware.io
            • Categories
            • Recent
            • Tags
            • Popular