#include "ToggleSwitch.h"
// Define constants for the pin numbers
const int LED_PIN_1 = 2; // LED for position 1
const int LED_PIN_0 = 3; // LED for position 0
const int LED_PIN_N1 = 4; // LED for position -1
const int BUTTON_PIN_UP = 5; // Button to move up (increase position)
const int BUTTON_PIN_DOWN = 6; // Button to move down (decrease position)
// Create an instance of ToggleSwitch with the defined constants
ToggleSwitch toggleSwitch(LED_PIN_1, LED_PIN_0, LED_PIN_N1, BUTTON_PIN_UP, BUTTON_PIN_DOWN);
void setup() {
Serial.begin(9600); // Initialize Serial communication for debugging
// No setup needed as the ToggleSwitch constructor handles it
}
void loop() {
toggleSwitch.update(); // Call the update method in the loop
// Debug output of the current state
Serial.print("Current Position: ");
Serial.println(toggleSwitch.getCurrentPosition());
delay(200); // Delay for readability in the Serial Monitor
}