Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import smbus
- import time
- bus = smbus.SMBus(1)
- address = 0x04
- bus.write_byte_data(address,0x01,0x00)
- time.sleep(0.1)
- while True:
- data = "1:"
- for i in range(0, 2):
- data += chr(bus.read_byte(address));
- print data
- data = "2:"
- data += chr(bus.read_i2c_block_data(address,0));
- print data
- time.sleep(1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement