jynote

树莓派vcgencmd命令查看硬件状态

1.vcgencmd commands可看到vcgencmd可接的指令

 

 2. 在python中读取树莓派cpu温度

因为os.popen返回的是一个文件,因此要用readline()进行文件的读取

print(os.popen(\'vcgencmd measure_temp\').readline())

 

也可用replace函数使得返回一个温度数值

import os
rec = os.popen(\'vcgencmd measure_temp\').readline()
print(rec.replace("temp=","").replace("\'C\n",""))

 

分类:

技术点:

相关文章:

  • 2021-12-17
  • 2022-03-03
  • 2022-02-23
  • 2021-12-13
  • 2021-11-20
  • 2021-12-16
  • 2022-12-23
  • 2021-07-24
猜你喜欢
  • 2022-02-10
  • 2022-02-08
  • 2022-02-26
  • 2022-03-01
  • 2022-01-29
  • 2022-03-02
  • 2022-02-19
相关资源
相似解决方案