sp3czialist
New member
Hello,
I'm all new too this stuff and i really need help because i cannot find anything online on this. I've done some basic Arduino projects but came across Teensy for a joystick analog.
I want to use this: https://exoelectro.co.uk/wp-content/uploads/2020/02/JoystickModule-e1581200506253.jpg
Joystick analog module as the left analog joystick for movement.
There are 5 pins on this module
GND
+5V
VRX
VRY
SW
On the teensy LC board ive put them too this:
https://i.gyazo.com/9280485ebcf981d0e1a6f53d1af60312.png
Im using Xinput and installed the AVR and lib
this is the code im using:
it uploads fine
it shows in device manager but there is a message: https://i.gyazo.com/2de20f222898bbed15fc624b897638cd.png
and on this website: https://gamepad-tester.com/
it is not detected at all.
Can anyone help me what im doing wrong?
sorry for my english.
I'm all new too this stuff and i really need help because i cannot find anything online on this. I've done some basic Arduino projects but came across Teensy for a joystick analog.
I want to use this: https://exoelectro.co.uk/wp-content/uploads/2020/02/JoystickModule-e1581200506253.jpg
Joystick analog module as the left analog joystick for movement.
There are 5 pins on this module
GND
+5V
VRX
VRY
SW
On the teensy LC board ive put them too this:
https://i.gyazo.com/9280485ebcf981d0e1a6f53d1af60312.png
Im using Xinput and installed the AVR and lib
this is the code im using:
Code:
/*
* Project Arduino XInput Library
* @author David Madison
* @link github.com/dmadison/ArduinoXInput
* @license MIT - Copyright (c) 2019 David Madison
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Example: SimulateAll
* Description: Automatically activate all possible XInput controls.
* Useful to test that everything is functioning properly.
*
* WARNING: This will spam inputs! Ground pin '0' (RX) to stop.
*
*/
#include <XInput.h>
// Config Settings
const unsigned long CycleTime = 5000; // ms
const int SafetyPin = 0; // Ground this pin to prevent inputs
// Joystick Setup
const int JoyMax = 32767; // int16_t max
const double angle_precision = (2 * PI) / (CycleTime / 4); // 4 because 250 Hz update rate
double angle = 0.0;
void setup() {
pinMode(SafetyPin, INPUT_PULLUP);
XInput.setAutoSend(false); // Wait for all controls before sending
XInput.begin();
}
void loop() {
if (digitalRead(SafetyPin) == LOW) {
return;
}
// Calculate joystick x/y values using trig
int axis_x = sin(angle) * JoyMax;
int axis_y = cos(angle) * JoyMax;
angle += angle_precision;
if (angle >= 360) {
angle -= 360;
}
XInput.setJoystick(JOY_LEFT, axis_x, axis_y); // Clockwise
XInput.setJoystick(JOY_RIGHT, -axis_x, axis_y); // Counter-clockwise
// Send values to PC
XInput.send();
}
it shows in device manager but there is a message: https://i.gyazo.com/2de20f222898bbed15fc624b897638cd.png
and on this website: https://gamepad-tester.com/
it is not detected at all.
Can anyone help me what im doing wrong?
sorry for my english.
Last edited by a moderator: