Guest User

Untitled

a guest
Oct 21st, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import datetime
  2. import time
  3.  
  4. import Adafruit_GPIO.SPI as SPI
  5. import Adafruit_MAX31855.MAX31855 as MAX31855
  6.  
  7.  
  8. # Define a function to convert celsius to fahrenheit.
  9. def c_to_f(c):
  10. return c * 9.0 / 5.0 + 32.0
  11.  
  12.  
  13. # Raspberry Pi software SPI configuration.
  14. CLK = 25
  15. CS = 24
  16. DO = 18
  17. sensor = MAX31855.MAX31855(CLK, CS, DO)
  18.  
  19. wb = xlwt.Workbook()
  20. ws = wb.add_sheet("Temp Measurements")
  21. now = datetime.datetime.now()
  22.  
  23. i=0
  24. p=1
  25. #for i in range (11):
  26. while i <= 21:
  27. if i == 20:
  28. wb.save("Temps Collected" + str(now))
  29. i = 0
  30. temp = sensor.readTempC()
  31. ws.write(p,0,datetime.datetime.now())
  32. ws.write(p,1,temp)
  33. i+=1
  34. p+=1
  35. print(temp)
  36. time.sleep(30)
  37. print(i)
  38.  
  39. #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