Joystick for pspi
That's exactly what I did on the simple joystick circuit. The joystick is just 2 variable resistors, so they will divide any voltage you put on them. If you put 5v then the center point will be around 2.5v, and if you put 3.3v then the center point will be around 1.65v.
You can put any voltage you want on the joystick input and it will divide it.
This is all a question here so please bear with me.
But my point is why use the comparator? Am I wrong that the pi can accept an analog input? Lets say the resistance of the entire x axis is 10k. Then the mid point would be at 5k. if the voltage expected on the gpio is 3.3v and the vcc is 1.3v (approx half) then a ratio value would be 3.3v/255:1.3v/100.455est. then the mid point value of the x axis should have a reading of around 50.23. Could we not set a variable say xValue = read(gpioPin)? Then determine if it needs to increase or decrease speed by the amount of change?
I am not sure of the actual syntax here so sorry. I have been out of the programming loop for awhile now.
I understand now. No, the pi does not have analog input. The GPIO is either off or on, nothing in-between. The only option to get true analog is an analog to digital converter that has proper drivers for the Pi. I'm working on a solution for it using a relatively cheap ADC, but it's going to take some time.