Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- import time
- import Adafruit_GPIO.SPI as SPI
- import Adafruit_MAX31855.MAX31855 as MAX31855
- # Define a function to convert celsius to fahrenheit.
- def c_to_f(c):
- return c * 9.0 / 5.0 + 32.0
- # Raspberry Pi software SPI configuration.
- CLK = 25
- CS = 24
- DO = 18
- sensor = MAX31855.MAX31855(CLK, CS, DO)
- wb = xlwt.Workbook()
- ws = wb.add_sheet("Temp Measurements")
- now = datetime.datetime.now()
- i=0
- p=1
- #for i in range (11):
- while i <= 21:
- if i == 20:
- wb.save("Temps Collected" + str(now))
- i = 0
- temp = sensor.readTempC()
- ws.write(p,0,datetime.datetime.now())
- ws.write(p,1,temp)
- i+=1
- p+=1
- print(temp)
- time.sleep(30)
- print(i)
- #To convert from computer time to relevant time use: =(((A1/60)/60)/24)+DATE(1970,1,1)
Add Comment
Please, Sign In to add comment