Created
January 18, 2020 16:32
-
-
Save lesp/ce820dff3744c548d21ade2021b26324 to your computer and use it in GitHub Desktop.
This is the code which is not working as expected, the Y value is wildly wrong.
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 | |
print("Please ensure that the joystick is centred, the test will start in...") | |
for i in range(3,0,-1): | |
print(i) | |
time.sleep(1) | |
print("The resting value for each axis is as follows...") | |
time.sleep(1) | |
y = bus.read_byte_data(address, 1) | |
x = bus.read_byte_data(address, 0) | |
print("Y = ",y,"X = ",x) | |
print("Move the joystick to the top and hold...") | |
time.sleep(3) | |
y = bus.read_byte_data(address, 1) | |
print(y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment