How does it work? Sleep , WDG ..

  • Hi.
    I want ask for more detail about few function .
    Sleep - what timer is used and on what mode??
    Watch dog - if set in MCU fuse bit Watch dog always On .. how to set WDG in MySensor ?


  • ....em ... why you not write to me that Watch dog is not possible to use because is used for sleep function..

    now better understand it..


    gw.process(); is result true or false .. what depend what is result?
    and how to check ACK if sens pakcet to gateway??


  • Admin

    It returns true if there is a (none-internal) message available destined for this node. But usually you would want to use the call-back functionality to pick up the messages.

    Regarding sleep.. not forbidden to look in the code you know... ;)

  • hi hek ..
    Yes I look to source code to understand how it working ..
    for sleep function I understand for 100% .. is used watchdog as timer ..and INT0,INT1 for wake up from sleep ..

    but for ACK .. pls write the practical code how to check if send packet from (for example : BinarySwitchSleep ) node to gateway check ACK , that packet delivery for 100% to gateway.. I need to know this ...

    pls help me with this code ..

    regards ..

  • Admin

  • good.. but problem is not possible for battery operated..
    I want make binary switch sleep with ack function.. is it possible??
    If send command to gateway want inform user that packet delivery for 100%.. but battery operated..

    in my house I use rf switch on the wall .. not working for 100% and are only one way (not inform if command 100% delivery) then I want new one ..
    battery operated device with ACK..


  • Admin

    Then you myst wait and call process() for a while before going to sleep or resend message.

  • yes.. I know must wait some time .. but I don't know how to do it .. I can use some timer for waiting .. but need help with this .. then use example for relay actuator .. and if send packet from button (int0 for example) then wait some time (100ms for example) if not received ACK then beep or blink led..


  • Admin

    No need to introduce times... just use millis().

    Pseudo code:

    unit saved_time;
    loop() {
        if (value-changed-and-time-to-send) {
             saved_time = millis();
        if (millis()-saved_time > 500)   // 0.5 sec

  • yeah , I will test it .. thanks . If button change then send packet with ACK , and wait .. if not ack received then error ..


Log in to reply

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.