Main > Driving & Racing Cabinets

Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help

<< < (2/5) > >>


--- Quote from: Vee21 on November 12, 2021, 04:02:50 am ---My aim is to get the steering wheel and pedals working then move on to the shifter. I'll let you all know how it goes, if anyone has any tips tricks please post!

--- End quote ---
I'd say the best starting point is to define the controls/inputs you will eventually need.
  Wheel - 1 potentiometer
  Pedals - 2 potentiometers
  Shifter - 2 microswitches, 2 optical switches
  Buttons - Coin, View(?), Mode(?), etc.

Looks like it adds up to 3 pot and 7+ button/optical inputs.

I think baritonomarchetto did some encoder sketches that should cover the wheel, pedals, and buttons, but I can't find the related post(s).   :dunno
- Check out his project thread here for some inspiration.   :cheers:

The shifter code will be more complicated, but if you initialize the inputs correctly and set up the program loop so the shifter logic is at the end of the program loop and works something like this (it's not actual code), it should work:

if ShifterUpSwitch = pressed goto 135 subroutine
else if ShifterDownSwitch = pressed goto 246 subroutine
else gear = N
restart program loop

(135 subroutine)
if Shifterleft = pressed, gear = 1
else if ShifterRight = pressed, gear = 5
else gear = 3
restart program loop

(246 subroutine)
if Shifterleft = pressed, gear = 2
else if ShifterRight = pressed, gear = 6
else gear = 4
restart program loop


Yes, I wrote an instructable about that:

I will update that in the near future with version 2 of that interface board (giroscope added for virtual pinballs)


--- Quote from: baritonomarchetto on November 13, 2021, 03:08:00 am ---Yes, I wrote an instructable about that:

--- End quote ---
That's the one I was thinking about.   :cheers:

Looks like it would be easy to take the potentiometers.ino from GitHub and add pedals by changing:
- Line 11 to "true, true, true,    // X, Y, Z Axis"
- Line 14 to "true, true, true);   // No accelerator, brake, or steering"
- Lines 16-31 to add the accelerator/brake pins, variables, ranges, loop steps, and subroutines

--- Code: ---/* ArcadeHID - steering wheel handling example
 * gamepad emulation
 * by Barito, 2021

#include <Joystick.h>

0, 0,                  // Button Count, Hat Switch Count
true, false, false,    // X, Y, Z Axis
false, false, false,   // No Rx, Ry, or Rz
false, false,          // No rudder or throttle
false, false, true);   // No accelerator, brake, or steering
const int steerPin = A0;
int steerValue;

void setup() {
Joystick.setXAxisRange(0, 1023); //Joystick.setXAxisRange(min, max);

void loop() {

void SteerWheel(){
steerValue = analogRead(steerPin);

--- End code ---

The hard part is to add 7 inputs and 10 gamepad(?) button outputs.

Looks like you'd change line 10 to "10, 0,                  // Button Count, Hat Switch Count", but you'd also need to:
- Initialize the 7 input pins
- Read the pins
- Translate the 4 shifter inputs into the one of seven possible button presses that corresponds to the current position of the shifter (gear 1-6 or N)
- Output the regular (coin, view, mode) and shifter button presses


This is amazing, thanks for the help baritonomarchetto and PL1. I bought a Leonardo board today and using the code from ArcadeHID-potentiometers.ino I've got the steering wheel working in Teknoparrot! Now to wire up and add in the pedals to the sketch and test it out. Then I'll tackle the View, Mode and Coin buttons then try my luck with the shifter.

I'll send an update once I get the pedals working.

Cheers :cheers:


Made some slight progress tonight and will try continue tomorrow if I get some free time. I've updated Barito's code just by copying the logic of the original and adding in Brake and Accel and getting inputs from the pedals but some strange behavior.

The strange thing is when I Serial Print the Accel and Brake pedals they read in a weird range and do not start from 0, for example the Accel pedal reads from 490 - 920 (pedal fully compressed). Would this be an indicator of bad wiring/ground or something else??


[0] Message Index

[#] Next page

[*] Previous page

Go to full version