当前位置:网站首页>2.17 haas506 2.0 development tutorial system (only versions above 2.2 are supported)

2.17 haas506 2.0 development tutorial system (only versions above 2.2 are supported)

2022-06-23 06:38:00 Zhiyunfu

1. Development board sleep 、 To turn it off 、 restart

Case description

  • This case demonstrates the use of the development board to automatically shut down and restart .

main.py

import system
import utime

# Sleep 
system.lightsleep()
# After hibernation , Device power consumption will be reduced , The program can run 
utime.sleep(2)
# Exit dormancy 
print(' Value returned from hibernation :',system.lightsleep(0))
utime.sleep(2)
# To turn it off , The program will not run after shutdown 
system.poweroff()
''' # restart  system.reset() '''

Output

<E>platform_sys SleepEnable1:0
 Value returned from hibernation : 0

3.Class-system

resetpowerofflightsleep
Module restart Module shutdown Normal sleep mode

system - System module

  • Module function : Control the startup, restart and sleep functions of the development board .

reset - Module restart

  • The functionality : Module restart

  • The function prototype :

system.reset()

  • Parameter description : nothing

poweroff() - Module shutdown

  • The functionality : Module shutdown

  • The function prototype :

system.poweroff()

  • Parameter description : nothing

lightsleep - Normal sleep mode

  • The functionality : Normal sleep mode , Reduced power consumption after sleep

  • The function prototype :

system.lightsleep(value)

  • Parameter description :
Parameters explain
No parameter Sleep all the time
value = 0 Exit dormancy
  • Return value : Return value =0, normal , Return value =-1, Failure
原网站

版权声明
本文为[Zhiyunfu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230512037343.html