Created
January 18, 2020 16:28
-
-
Save lesp/d1823b12ff0478bcca432cfcbe221da1 to your computer and use it in GitHub Desktop.
This code works! It constantly prints the values reported from an analog to I2C board as I move an analog joystick around.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smbus | |
import time | |
bus = smbus.SMBus(1) | |
address = 0x48 | |
while True: | |
y = bus.read_byte_data(address, 1) | |
x = bus.read_byte_data(address, 0) | |
print("Y = ",y,"X = ",x) | |
time.sleep(0.01) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output looks like this
Y = 184 X = 219
Y = 184 X = 219
Y = 184 X = 219
Y = 184 X = 219
Y = 184 X = 219
Y = 184 X = 219
Y = 184 X = 219
Y = 184 X = 219
Y = 184 X = 219
Y = 184 X = 219
Y = 184 X = 219