diff --git a/MAX31855_RPi.txt b/MAX31855_RPi.txt index 3243b9a..d0db0be 100644 --- a/MAX31855_RPi.txt +++ b/MAX31855_RPi.txt @@ -1,6 +1,6 @@ -Provided by a helpful customer - thanks! +#Provided by a helpful customer - thanks! -Here is the code written in python tested and working with the device on raspberry pi. You can adjust the sleep time as you want but you cannot go any lower than .125 ms from my experience. +#Here is the code written in python tested and working with the device on raspberry pi. You can adjust the sleep time as you want but #you cannot go any lower than .125 ms from my experience. import time @@ -10,7 +10,7 @@ import RPi.GPIO as GPIO # Define a function to convert celsius to fahrenheit. def c_to_f(c): -return c * 9.0 / 5.0 + 32.0 + return c * 9.0 / 5.0 + 32.0 # Raspberry Pi software SPI configuration. CLK = 25 @@ -28,16 +28,16 @@ tc = 0 # Loop printing measurements every second. print('Press Ctrl-C to quit.') while True: -GPIO.output(T0, tc & 1<<0) -GPIO.output(T1, tc & 1<<1) -GPIO.output(T2, tc & 1<<2) -time.sleep(0.125) -temp = sensor.readTempC() -internal = sensor.readInternalC() -print('Sensor', tc) -print('{1:0.3F}'.format(temp, c_to_f(temp))) + GPIO.output(T0, tc & 1<<0) + GPIO.output(T1, tc & 1<<1) + GPIO.output(T2, tc & 1<<2) + time.sleep(0.125) + temp = sensor.readTempC() + internal = sensor.readInternalC() + print('Sensor', tc) + print('{1:0.3F}'.format(temp, c_to_f(temp))) #print('Thermocouple Temperature: {0:0.3F}*C / {1:0.3F}*F'.format(temp, c_to_f(temp))) #print(' Internal Temperature: {0:0.3F}*C / {1:0.3F}*F'.format(internal, c_to_f(internal))) -tc = tc+1 + tc = tc+1 if tc == 4: -tc=0 \ No newline at end of file +tc=0