Advertisement
Guest User

Untitled

a guest
Jul 25th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import smbus
  4. import time
  5. bus = smbus.SMBus(1)
  6. address = 0x04
  7.  
  8. bus.write_byte_data(address,0x01,0x00)
  9. time.sleep(0.1)
  10. while True:
  11. data = "1:"
  12. for i in range(0, 2):
  13. data += chr(bus.read_byte(address));
  14. print data
  15. data = "2:"
  16. data += chr(bus.read_i2c_block_data(address,0));
  17. print data
  18.  
  19. time.sleep(1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement