D
D
Di Da2019-03-13 20:28:49
Arduino
Di Da, 2019-03-13 20:28:49

How to write an algorithm for a touch joystick?

5c893c37527d5325391766.png
I'm making a wifi machine on arduino. And there is a joystick in the applications on the smartphone. While empty. It has x=min(-100), max(100); y=min(-100), max(100). As in the photo, the black line is its reach limit, and the rest is the joystick itself.
Let's imagine there are 2 wheels on a typewriter and I want to make the speed of the motor according to the position of the joystick. That is, if the joystick is point-blank, then the maximum speed, if near the center, then slowly. But you also need to consider rotation. A turn works by slowing down or accelerating the other wheel.
Please, help. We need an algorithm for absolutely! any language. Even Russian :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OnYourLips, 2019-03-13
@OnYourLips

If tank control (left and right motor on wheels separately), then:
left channel: vertical component plus horizontal.
right: vertical minus horizontal.
I understand that my answer looks extremely simple, but everything is actually extremely simple, the usual addition.
I already made my machine on arduino.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question