I am trying to embed the core temperature reading command within a python script, then use that output as a value to plug into a formula… to convert C to F…
This is literally my first time trying to free style in python. And it is going as well as one would suspect.
This is because os.system() doesn’t return the output of the command, but rather the status code.
The status code for “Ran without error, exited cleanly” is 0. So your Celcius value will always be 0.
0 Celcius is - according to your conversion formula (9.0/5.0 * 0 + 32) - 32 Farhenheit, which would mean the rest of your code is simply running as intended and you see the results 0 and 32.
You should use os.popen().read() to return the value that vcgencmd produces.
Note- vcgencmd doesn’t return a simple integer, but rather the text string: temp=xx.x'C so you will need to find a way to parse the actual temperature out of this string and convert it to a number.
Could it be a python formatting thing? From mine: (and my reading is a float, not an int but I’m sure you could format it without the decimal places if that’s what you want? Or convert the values from Python?)