nodemcu-firmware/docs/modules/node.md

1.5 KiB

##node.restart() ####Description restart the chip.

####Syntax node.restart()

####Parameters

  • nil

####Returns

  • nil

####Example

    node.restart();

node.dsleep()

####Description Enter deep sleep mode, wake up when timed out.

####Syntax node.dsleep(us, option)

Note: This function can only be used in the condition that esp8266 PIN32(RST) and PIN8(XPD_DCDC aka GPIO16) are connected together. Using sleep(0) will set no wake up timer, connect a GPIO to pin RST, the chip will wake up by a falling-edge on pin RST.
option=0, init data byte 108 is valuable;
option>0, init data byte 108 is valueless.
More details as follows:
0, RF_CAL or not after deep-sleep wake up, depends on init data byte 108.
1, RF_CAL after deep-sleep wake up, there will belarge current.
2, no RF_CAL after deep-sleep wake up, there will only be small current.
4, disable RF after deep-sleep wake up, just like modem sleep, there will be the smallest current.

####Parameters

  • us: number(Integer) or nil, sleep time in micro second. If us = 0, it will sleep forever. If us = nil, will not set sleep time.

  • option: number(Integer) or nil. If option = nil, it will use last alive setting as default option.

####Returns

  • nil

####Example

    --do nothing
    node.dsleep()
    --sleep μs
    node.dsleep(1000000)
    --set sleep option, then sleep μs
    node.dsleep(1000000, 4)
    --set sleep option only
    node.dsleep(nil,4)