Joystick modul med analog værdier af 2 akser og en digital trykknap
Joystick
Denne komponent er smart til at lave controller, den kan afsende analog værdier af både x og y aksen, derudover har den også en digital push knap som afsender et signal når joysticket trykkes ned.
Tekniske specifikationer
Operativ spænding | 3.3V - 5V |
Interface | 2x Analog - 1x Digital |
Kode Eksempel
from machine import Pin, ADC
from time import sleep
button = Pin(4, Pin.IN)
y = ADC(Pin(36))
x = ADC(Pin(37))
while True:
print("Knap vaerdi: ", button.value())
print("Y vaerdi: ", y.read())
print("X vaerdi: ", x.read())
sleep(0.1)
Pinout
Pinout
Nummer | Navn | Spænding | ROLLE |
---|---|---|---|
1 | G (GND) | 0V | Negativ forsyning |
2 | V (VCC) | 3.3V - 5V | Positiv forsyning |
3 | B (Digital) | 0-5V | Digital knap signal |
4 | X (Analog) | 0-5V | Analog x akse værdi |
5 | Y (Analog) | 0-5V | analog y akse værdi |
Hvordan fungerer den?
Referencer
Joystick med ESP32: https://sankios.imediabank.com/2-axis-joystick
Joystick med display: https://esp32.com/viewtopic.php?t=14803
ESP32 joystick med gamepad: https://www.instructables.com/ESP32-BLE-GamePad/
Inspiration og kommentarer
Er du faldet over links eller lignende, som kan være relevant for dine medstuderende så send os en mail på nini@kea.dk