Advertisement
Guest User

Untitled

a guest
May 5th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1.   GNU nano 2.2.6                 File: thetiedosto.py                                Modified
  2.  
  3. #!/usr/bin/python
  4. import picamera
  5. from time import sleep
  6. import time
  7. import smbus
  8. import sys
  9.  
  10. tavoitelampo = 80
  11.  
  12. def lampotila():
  13.         temperature = 0
  14.         REG_TEMP = 0b00
  15.         I2C_ADDRESS = 0x48
  16.  
  17.         bus = smbus.SMBus(1)
  18.         temperature = bus.read_byte_data(I2C_ADDRESS, REG_TEMP)
  19.         return temperature
  20.  
  21. print lampotila()
  22.  
  23. def arvioi():
  24.         nykyinenLampo = lampotila()
  25.  
  26.         #if nykyinenLampo >= tavoitelampo:
  27.         #       print "Joo 80 astet"
  28.         #else:
  29.         #       print "Ei viel oo 80"
  30.  
  31.  
  32.  
  33. #arvioi()
  34.  
  35.  
  36.  
  37.  
  38. def stopwatch(seconds):
  39.     start = time.time()
  40.     time.clock()
  41.     elapsed = 0
  42.     while elapsed < seconds:
  43.         elapsed = time.time() - start
  44.         print "%02d" % (elapsed)
  45.         #print "loop cycle time: %f, seconds count: %02d" % (time.clock() , elapsed)
  46.         time.sleep(60)
  47.  
  48. #6h laskuaikaa
  49. stopwatch(21600)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement