Joystick Input Demo Using Arduino Leonardo as Mouse/Keyboard Input to p5js

preview_player
Показать описание
A quick demo using the Arduino Leonardo, a joystick, and some buttons as mouse and keyboard input to p5js. All source code linked below.

The Arduino sketch converts analog input on A0 and A1 to control the x and y movements of the mouse. Uses digital input on pins 2, 3, 4, 5, 6 for UP_ARROW, RIGHT_ARROW, DOWN_ARROW, LEFT_ARROW, and SPACE BAR respectively on the keyboard.

Digital input on pin 7 toggles the joystick on and off. All digital input is assumed to use the Arduino's internal pull-up resistors


This sketch will work with any 32u4- or SAMD-based boards like the Arduino Leondardo, Esplora, Zero, Due, which can appear as a native mouse and/or keyboard when connected to the computer via USB.

Arduino code:

p5js code:
Рекомендации по теме
Комментарии
Автор

Excellent Project brother thanks for share

carlosaarias
Автор

hey man! i love this. i have a question and i really need help. i just need the code for the left stick. i’m trying to make a keyboard with a joystick in place of the space bar. it would be really great if you could send me a code or write a code just for the left stick to be to move like wasd or the same as controller. pls respond ik ur still active

Gushalol
Автор

no logro entender para que es este boton BUTTON_MOUSE_TOGGLE_PIN = 7;

jorgesaul
Автор

How about :) Thanks for the video
sorry, there is a possibility to remove the parameter
const int BUTTON_MOUSE_TOGGLE_PIN = 7;

I just want the spacebar and some other keys that I assign to the source code but when it comes to removing the parameter
const int BUTTON_MOUSE_TOGGLE_PIN = 7;
It becomes a mess for me

jorgesaul
join shbcf.ru