Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4825

Python • Re: CPU Temperature Test Not Working; Need File Format

$
0
0
Thank you everyone for all your help! I now am getting another error, though:

Code:

Traceback (most recent call last):  File "/home/<user>/Documents/heatplotter.py", line 7, in <module>    from vcgencmd import VcgencmdModuleNotFoundError: No module named 'vcgencmd'
Does anybody know what this means? I am running this code now:

Code:

#!/usr/bin/python# -*- coding: iso8859-1 -*-import sys,subprocessimport osimport timefrom vcgencmd import Vcgencmddef main():    start_time = time.time()    fb = open("/home/pi/readings.txt","a+")    fb.write("Elapsed Time (s),Temperature (°C),Clock Speed (MHz),Throttled\n")    vcgm = Vcgencmd()    while True:        temp = vcgm.measure_temp()        clock = int(vcgm.measure_clock('arm')/1000000)        throttled = vcgm.get_throttled()['breakdown']['2']        string = '%.0f,%s,%s,%s\n' % ((time.time() - start_time),temp,clock,throttled)        print(string, end='')        fb.write(string)        time.sleep(1)if __name__ == '__main__':    main()

Statistics: Posted by 83zr5 — Tue Oct 01, 2024 11:38 pm



Viewing all articles
Browse latest Browse all 4825

Trending Articles