cancel
Showing results for 
Search instead for 
Did you mean: 

Read ADC from 2 joysticks with STM32F4xx

trungvan
Visitor

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.

5 REPLIES 5
Dor_RH
ST Employee

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

What joysticks?

JW

I am using two HW-504

 

Karl Yamashita
Principal

show some code, attached your IOC file

I was told that if a devices starts to smoke, put the smoke back in. I guess I never got all the smoke because the device never worked afterwards.
Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.

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.