Advertisement
Guest User

Untitled

a guest
May 27th, 2015
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. from phant import Phant
  2.  
  3. from serial import Serial
  4.  
  5. import time
  6.  
  7. p = Phant('XGXqQ3maWluV1vn9xLgQ', 'moisture', private_key='REPLACEMEWITHPRIVATEKEY')
  8.  
  9. s = Serial('COM3')
  10.  
  11. last = None
  12. while True:
  13. line = s.readline()
  14. last = last or time.time()
  15. if time.time() - last > 15:
  16. last = time.time()
  17. print(line)
  18. m = int(line.decode().split('=')[1].strip())
  19. print(m)
  20. p.log(m)
  21. print(p.remaining_bytes, p.cap)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement