Skip to main content
6 votes
Accepted

How can I compensate for a joysticks offset value in neutral position?

You can only approximate it, you have to sacrifice something. The basic problem is that your input range is asymmetric in respect to the mid point. Let's visualize it this way (with a bit of visual ...
orithena's user avatar
  • 499
3 votes
Accepted

How to use a USB host shield with different HID Joysticks

Reading and understanding a report descriptor can be a bit of a black art at times. They're quite cryptic when you first look at them, but actually they make perfect sense. If you think of each entry (...
Majenko's user avatar
  • 105k
3 votes
Accepted

Joysitck with servo, LED array and buzzer

You have a distinct set of requirements that you could turn into a sketch yourself. I'm guessing you have never written a program before, in which case the problem really is you don't know how to do ...
Code Gorilla's user avatar
  • 5,637
2 votes
Accepted

Simulate 9-pin joystick output

I would isolate the two devices using opto-isolators. simulate this circuit – Schematic created using CircuitLab Turning the output ON will illuminate the infra-red LED in the opto-isolator ...
Majenko's user avatar
  • 105k
2 votes
Accepted

Servos not working properly with joystick

The problem, as jsotola pointed out, is that your code writes totally different values to the servos very fast. You don't combine the two values from the joystick, but just overwrite the previous ...
chrisl's user avatar
  • 16.4k
2 votes

How can I PWM 4 LEDs from 0 to full brightness using a two axiz resistive joystick?

There's a number of steps you need to go through: Read the ADC to get the joystick position Subtract 50% of the full range (512) to get a ±512 value Note the sign to get the direction Take the ...
Majenko's user avatar
  • 105k
2 votes

I want a Rotary Encoder to make 10 steps at once, but my code isn't working. What am I doing wrong?

This is not an answer to the question, but a tip about simplifying your code. This is a snippet of your code. void loop() { // some more code here int encoder1State = encoder1.get_change(); ...
jsotola's user avatar
  • 1,515
2 votes
Accepted

Can I make an Arduino Uno Rev3 pretend to be a joystick?

The Uno doesn't have native USB capabilities. It uses an additional microcontroller (the Atmega16u2) as an USB to Serial adapter. In the default configuration this microcontroller is only programmed ...
chrisl's user avatar
  • 16.4k
2 votes

Emulate Joystick

Based on your wiring information, this looks like an analog joystick. You specified using two digital output pins to emulate the joystick to the target device. The way to do this is to use PWM and a ...
wulph's user avatar
  • 21
2 votes

Emulate Joystick

Maybe "DS3502 I2C Digital 10K Potentiometer" will work. I am interested to hear if it really works as a joystick pot replacement because I have never used it.
gbafamily's user avatar
2 votes

Can Arduino UNO be used to emulate a PS4 joystick?

TLDR: Not sure but the PS4 protocol is known and written for other MCUs, and can be found on github. Not sure if there is a library for it in Arduino, but there are libraries out there (such as ...
joe's user avatar
  • 21
2 votes

Im trying to map a joystick to a servo but need the servo to be at 0 when the joystick is in nerural. And up to 180 when joy is forward or back

Try this one although, the others answered you properly : #include <Servo.h> Servo myservo; int potpin = 1; int val; void setup () { myservo.attach(9); } void loop () { val = ...
Curious guy's user avatar
1 vote
Accepted

Problems with reacting to joystick button press

As was mentioned in @chrisl 's comment: pin 1 on an Arduino Uno/Nano is the TX (transmit) pin for the Serial port. See here. This is the pin that is used to transmit serial data to the host. When the ...
StarCat's user avatar
  • 1,661
1 vote
Accepted

Expose two HID Joystick devices with single RP2040 board (Waveshare Pi Pico Zero)

By selecting the Adafruit TinyUSB USB stack option (Tools->USB Stack->Adafruit TinyUSB) of the arduino-pico core instead of the default (Pico SDK) the USB HID descriptors can be configured ...
NeilenMarais's user avatar
1 vote

Im trying to map a joystick to a servo but need the servo to be at 0 when the joystick is in nerural. And up to 180 when joy is forward or back

You can use the map function, see Arduino Map Function. So in your case, assuming a value of 0..1023 coming from an analog pin, where 0 needs to be mapped to -180 and 1023 to +180, you get int ...
Michel Keijzers's user avatar
1 vote

Transmitting multiple values to an Arduino, and interpreting them with minimum delay

I don't know about commercial drones, however your 'protocol' seems to be quite efficient, as it uses 4 bytes to send 2 values (e.g. U3F5) for Up with speed 3 and Forward with speed 5. Let's assume ...
Michel Keijzers's user avatar
1 vote

Arduino Joystick Library not Recognized by Games (Steam)

There is an Arduino Xbox 360 (XInput) library. But I do not use Steam so I have no idea if this works. https://github.com/dmadison/ArduinoXInput
gbafamily's user avatar
1 vote

Problem using 2 motors

The Arduino can definitely not power that many motors. The Arduino's max output current is 0.1A and you might be drawing around 0.5A. Use an external battery like a LiPo battery for the motor ...
DragonflyRobotics's user avatar
1 vote
Accepted

Is the code correct? Nrf24l01

I see (at least one ) problem. First remove the * from: int* Msg, mSg, msG; Because it should store integers (numbers), not pointers to numbers. Also, make the variables better. These almost ...
Michel Keijzers's user avatar
1 vote
Accepted

Stuck making multi, many button, joysticks

Each ShiftIn instance handles just one connection. You need to make multiple instances. ShiftIn shift1<3>; ShiftIn shift2<3>; ShiftIn shift3<3>; Then you begin each of them: void ...
Majenko's user avatar
  • 105k
1 vote
Accepted

Run website / Javascript game from a Arduino UNO device?

The Arduino cannot run Javascript, no. It could serve Javascript from an SD card to a web browser running on a PC / Pi / Phone, etc, but there is no way it can run it itself.
Majenko's user avatar
  • 105k
1 vote
Accepted

Reading Multiple Analog Input Pins

I can't reproduce your problem. Your code is a bit lengthy to say for certain whether or not A0 and A3 clash when read in quick succession. Try this test code and see what results you get: void setup(...
Nick Gammon's user avatar
  • 38.4k
1 vote

USB Host Shield plus 2 identical joysticks

Not quite the question that was asked but part of the problem. This is a simple introduction to pointers. int variable = 42; // Create a variable int* pointer = &...
Code Gorilla's user avatar
  • 5,637
1 vote

Arduino force feedback vibration gamepad

That library has no support for vibration. The HID report descriptor has to include the correct OUTPUT items for the PC to send the vibration instructions to the Arduino - and of course the library ...
Majenko's user avatar
  • 105k
1 vote

Interfacing Logitech Joystick to Arduino and interrupt a while loop

As full code is not posted I cant suggest you correctly but you should add the two buttons, START & STOP. When STOP button is pressed all events (your code is performing on) should stop working. ...
Sonali_B's user avatar
  • 443
1 vote

analogRead returning 0 constantly when connected to joystick

Follow these steps to identify the problem. Disconnect A0/A1 from Arduino and use a multimeter to check the voltage coming from the joystick X and Y. If it swings from 0 to 5V....the problem is in ...
vu2aeo's user avatar
  • 81
1 vote
Accepted

How to: Connecting 4-pin Joystick to Arduino board

If the link that Mark Smith provided is correct, that is a “dual-axis mini xy joystick module PSP 2-Axis Analog Thumb Joystick Module Thumb Joystick for Arduino”, with (as other comments suggested) ...
James Waldby - jwpat7's user avatar
1 vote
Accepted

Arduino USB Host Shield with joystick

The following assumes you are seeing OnGamePadChanged being called. One way you could get the values you want (GamePadEventData *evt) into the loop() would be to add a member variable to the ...
Mark Smith's user avatar
  • 2,181

Only top scored, non community-wiki answers of a minimum length are eligible