Skip to main content
Associate
June 19, 2025
Question

Read ADC from 2 joysticks with STM32F4xx

  • June 19, 2025
  • 3 replies
  • 578 views

My project is a two-player Pong game using two joysticks, with each joystick controlling one paddle. The user interface was created using Touch GFX. The board is an STM32F429, and I have configured ADC1 to use channels 0 and 8. I’m using interrupts, but both paddles are currently being controlled by joystick 1, and joystick 2 has no effect. The adc_value1 and adc_value2 values read from the two joysticks via UART are identical.

Please help me correctly read the value from each joystick so that each paddle is controlled properly.

Thank you.

3 replies

ST Employee
June 19, 2025

Hello @trungvan,

I recommend checking out the example provided at this link: BSP example for STM32F429ZI-Nucleo: This example shows how to use the joystick feature.

This example might offer useful insights and solutions for your application.

I hope my response has been helpful. If your question is resolved, please mark this topic as the solution, as it will assist others in finding the answer more quickly.

Thank you for your contribution.

Dor_RH

 

waclawek.jan
Super User
June 19, 2025

What joysticks?

JW

trungvanAuthor
Associate
June 19, 2025

I am using two HW-504

 

Andrew Neil
Super User
June 19, 2025

So something like this:

AndrewNeil_1-1750349449808.png

https://www.aliexpress.com/item/1005008086523681.html

 


@trungvan wrote:

The board is an STM32F429


That's just a chip part number - it doesn't identify what board you have.

 

The hardware is an essential part of the project - so you need to give full details.

See: How to write your question to maximize your chances to find a solution.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Karl Yamashita
Principal
June 19, 2025

show some code, attached your IOC file

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source