34const int Pin_Gas = A2;
35const int Pin_Brake = A1;
36const int Pin_Clutch = A0;
42 JOYSTICK_DEFAULT_REPORT_ID,
43 JOYSTICK_TYPE_JOYSTICK,
50 false,
false,
false,
false,
false,
false);
52const int ADC_Max = 1023;
53const bool AlwaysSend =
false;
61 Joystick.begin(
false);
63 Joystick.setZAxisRange(0, ADC_Max);
64 Joystick.setRxAxisRange(0, ADC_Max);
65 Joystick.setRyAxisRange(0, ADC_Max);
78void updateJoystick() {
79 if (pedals.
hasPedal(SimRacing::Gas)) {
80 int gasPedal = pedals.
getPosition(SimRacing::Gas, 0, ADC_Max);
81 Joystick.setRyAxis(gasPedal);
84 if (pedals.
hasPedal(SimRacing::Brake)) {
85 int brakePedal = pedals.
getPosition(SimRacing::Brake, 0, ADC_Max);
86 Joystick.setRxAxis(brakePedal);
89 if (pedals.
hasPedal(SimRacing::Clutch)) {
90 int clutchPedal = pedals.
getPosition(SimRacing::Clutch, 0, ADC_Max);
91 Joystick.setZAxis(clutchPedal);
Header file for the Sim Racing Library.
Interface with the Logitech pedals (Gas, Brake, and Clutch)
bool hasPedal(PedalID pedal) const
Checks if a given pedal is present in the class.
bool positionChanged() const
Checks whether the current pedal positions have changed since the last update.
virtual bool update()
Perform a poll of the hardware to refresh the class state.
virtual void begin()
Initialize the hardware (if necessary)
long getPosition(PedalID pedal, long rMin=0, long rMax=100) const
Retrieves the buffered position for the pedal, rescaled to a nominal range using the calibration valu...