Hello. This is my very first post. Let me begin by saying I am a code n0000b, times infinity, but I’m good at learning new things, so you don’t necessarily have to dumb things down too much.
I live in Phoenix where half of the year it’s too hot to go outside to exorcize. To remedy this, I’ve built a virtual reality bike (out of a stationary exorcize bike) to ride around in Grand Theft Auto V.
The pedals work fine, implementing a magnetic reed switch. It’s the handlebars that I’m stumped with. Stumped, because I’m very bad at code. I’ve got nothing.
Here’s how they work:
[I have an Arduino Uno R3 that I have successfully learned to firmware hack , so that it may be recognized as a keyboard.]
A rubber tread/track (whatever its called) rotates around the handlebar neck (d. A) (images attached)
That, in turn, rotates a linear 10k potentiometer, left to right. (d. B)
What I would like it to do is this:
When the handlebars are straight and the potentiometer is in the middle, I want the Arduino to move the mouse to the very center of the screen, so that I go straight.
When the handlebars are turned left, I’d like the mouse to move left. The further left the potentiometer is turned, the further left it goes, until it hits the end of the screen.
I would like the exact opposite to happen when the handlebars are turned right.
The programs I will be using this code with will be running at a 1920 x 1080 resolution, in full screen.
I’d also like to create a sketch that makes left turns hold the ‘A’ key and right turns hold the ‘D’ key, instead of the mouse, just to see what that performance is like also.
So now what do I do?
Whatever code you help me with, I will be eternally grateful for.
I’m sure that if whatever code you help me with doesn’t quite work, I will be able to tweak it as needed and learn from. (I also know there are probably easier ways to go about this, but I really want to try it this way)
Thank you for your time and consideration!
EDIT: I’d post my code so far, but I don’t have any. I literally have no idea how to take potentiometer code and convert it into mouse strokes. I’m sorry. Also sorry for the double post of attachments. I don’t know what happened there.