// Define the GPIO pins
const int pin1 = 2; // GPIO pin 1
const int pin2 = 3; // GPIO pin 2
// Define the sequence: (0, 0), (0, 1), (1, 0), (1, 1)
int brakeSequence[][2] = {
{0, 0},
{0, 1},
{1, 0},
{1, 1}
};
int currentStep = 0; // Track the current step in the sequence
void setup() {
// Initialize the GPIO pins as outputs
pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
// Set the initial state of the pins
digitalWrite(pin1, HIGH); // Pin 1 initial state is HIGH (1)
digitalWrite(pin2, LOW); // Pin 2 initial state is LOW (0)
}
void loop() {
// Set the GPIO pins based on the current sequence step
digitalWrite(pin1, brakeSequence[currentStep][0]);
digitalWrite(pin2, brakeSequence[currentStep][1]);
// Move to the next step in the sequence
currentStep = (currentStep + 1) % 4;
// Wait for 500ms before changing to the next state
delay(500);
}