Modify the Joystick code

Modified to the correct ADC input pin
This commit is contained in:
Suhayl
2018-07-11 14:07:34 +08:00
parent 5770211988
commit 9afdd9a547
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -30,8 +30,8 @@ int main(void){
while(1){
val_Z = digitalRead(Z_Pin); //read digital quality of axis Z
val_Y = analogRead(A1); //read analog quality of axis X and Y
val_X = analogRead(A2);
val_Y = analogRead(A0); //read analog quality of axis X and Y
val_X = analogRead(A1);
printf("val_X: %d ,\tval_Y: %d ,\tval_Z: %d \n",val_X,val_Y,val_Z);
delay(100);
}
+2 -2
View File
@@ -30,8 +30,8 @@ def setup():
def loop():
while True:
val_Z = GPIO.input(Z_Pin) #read digital quality of axis Z
val_Y = analogRead(1) #read analog quality of axis X and Y
val_X = analogRead(2)
val_Y = analogRead(0) #read analog quality of axis X and Y
val_X = analogRead(1)
print 'value_X: %d ,\tvlue_Y: %d ,\tvalue_Z: %d'%(val_X,val_Y,val_Z)
time.sleep(0.01)
BIN
View File
Binary file not shown.