Advertisement
Guest User

Untitled

a guest
Feb 17th, 2015
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import smbus
  2. import time
  3. #bus = smbus.SMBus(0)  # Rev 1 Pi uses 0
  4. bus = smbus.SMBus(1) # Rev 2 Pi uses 1
  5.  
  6. DEVICE = 0x12
  7. char=''
  8. out=''
  9. print bus.write_byte(DEVICE,15)
  10. print 'start'
  11. while True:
  12.     rd=bus.read_byte(DEVICE)
  13.     if rd==0:
  14.         print out
  15.         out=''
  16.         bus.write_byte(DEVICE,15)
  17.     else:
  18.         out = out+chr(rd)  
  19.     time.sleep(0.05)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement