#include <Arduino.h>
// Define GPIO pins for peripherals
#define LED_PIN 19
#define BUZZER_PIN 22
void setup() {
Serial.begin(9600); // Start serial communication at 9600 baud rate
pinMode(LED_PIN, OUTPUT); // Set LED pin as output
pinMode(BUZZER_PIN, OUTPUT); // Set Buzzer pin as output
Serial.println("Controller Board Ready"); // Initialization message
}
void loop() {
if (Serial.available() > 0) {
char command = Serial.read(); // Read the command from the PC
if (command == 'A') { // If 'A' is received, test LED
digitalWrite(LED_PIN, HIGH); // Turn on LED
delay(500); // Wait for 500ms
digitalWrite(LED_PIN, LOW); // Turn off LED
}
else if (command == 'B') { // If 'B' is received, test Buzzer
digitalWrite(BUZZER_PIN, HIGH); // Activate Buzzer
delay(500); // Wait for 500ms
digitalWrite(BUZZER_PIN, LOW); // Deactivate Buzzer
}
}
}