Avatar for Andrea

Andrea

Member since May 2019 • Last active May 2019
  • 1 conversations
  • 3 comments

Most recent activity

  • in Interfacing
    Avatar for Andrea

    great, it works!

    thank you so much!

    :-)

    • 3 comments
    • 423 views
  • in Interfacing
    Avatar for Andrea

    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 {};
    };
    

    What do you think I can solve?

    THANK YOU

Actions