Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions MAX31855_RPi.txt
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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
tc=0