Minor updates on the versions released so far.
- PC Joystick
The circuit can read up to 4 axes, but most of joysticks of that era only implements 2 or 3. Then whenever a potentiometer is not connected the value reported will be around the middle of the scale which means 200 counts for the standard 100K potentiometer.
Worth to remember that the circuit shall provide useful range for potentiometers up to 250k Ohms (around 1000 counts)
...
// Take care of disconnected axes
if (a1X == maxCounts ) a1X=midRange;
if (a1Y == maxCounts ) a1Y=midRange;
if (a2X == maxCounts ) a2X=midRange;
if (a2Y == maxCounts ) a2Y=midRange;
...
- Foot Pedal
Now the firmware can detect when a footpedal is not connected and does not report any key instead of report the they R continuously pressed.
void loop() {
sampleAnalogAxes();
if (a1Y < 100) { // Brake presse
Keyboard.press(KEY_V);
} else if (a1Y > 600) { // Pedal Not connected
Keyboard.releaseAll();
} else if (a1Y > 300) { // Gas pressed
Keyboard.press(KEY_R);
} else {
Keyboard.releaseAll();
}
.....
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.