Hi everyone,
I would like to use this Joystick: https://www.adafruit.com/product/512
with the Espruino WiFi (2v02), it currently works on Feather M4 Express (CircuitPython):
import ...
stickY = analogio.AnalogIn(board.A0) # analog
stickX = analogio.AnalogIn(board.A1) # analog
stickSelect = DigitalInOut(board.A2) # digital
stickSelect.direction = Direction.INPUT
stickSelect.pull = Pull.UP
while True:
... yValue = stickY.value
... xValue = stickX.value
... selectValue = stickSelect.value
... if yValue > 90 and yValue < 32000: print("Y DOWN")
... elif yValue > 40000 and yValue < 65500: print("Y UP")
... elif xValue > 90 and xValue < 32000: print("X LEFT")
... elif xValue > 40000 and xValue < 65500: print("X RIGHT")
... elif selectValue == False: print("PRESS")
... else: pass
In JavaScript I'm doing tests, Y and X both are recognized at '50 %' (yes UP and LEFT, no DOWN and RIGHT) ...
var BTN = {Y: A0, X: A1, SELECT: B10};
pinMode(BTN.Y, "input_pulldown");
pinMode(BTN.X, "input_pulldown");
pinMode(BTN.SELECT, "input_pulldown"); // (auto, input_pulldown and input_pullup) => NOT WORK
while(true){
if (BTN.Y.read()){console.log("Y");}
else if (BTN.X.read()){console.log("X");}
else if (BTN.SELECT.read()){console.log("SELECT");}
else {};
};
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi everyone,
I would like to use this Joystick: https://www.adafruit.com/product/512
with the Espruino WiFi (2v02), it currently works on Feather M4 Express (CircuitPython):
In JavaScript I'm doing tests, Y and X both are recognized at '50 %' (yes UP and LEFT, no DOWN and RIGHT) ...
What do you think I can solve?
THANK YOU