30const int Pin_Gas = A2;
31const int Pin_Brake = A1;
32const int Pin_Clutch = A0;
46 Serial.println(
"Starting...");
51 if (Serial.read() != -1) {
58 Serial.print(
"Pedals:");
60 if (pedals.
hasPedal(SimRacing::Gas)) {
62 Serial.print(
"\tGas: [ ");
63 Serial.print(gasPedal);
67 if (pedals.
hasPedal(SimRacing::Brake)) {
68 int brakePedal = pedals.
getPosition(SimRacing::Brake);
69 Serial.print(
"\tBrake: [ ");
70 Serial.print(brakePedal);
74 if (pedals.
hasPedal(SimRacing::Clutch)) {
75 int clutchPedal = pedals.
getPosition(SimRacing::Clutch);
76 Serial.print(
"\tClutch: [ ");
77 Serial.print(clutchPedal);
Header file for the Sim Racing Library.
Interface with the Logitech pedals (Gas, Brake, and Clutch)
void serialCalibration(Stream &iface=Serial)
Runs an interactive calibration tool using the serial interface.
bool hasPedal(PedalID pedal) const
Checks if a given pedal is present in the class.
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...