main.c hw4
main.c hw4
main.c hw4
h>
#include <stdlib.h>
#include <time.h>
#include "LEDs.h" // assuming LEDs.c module exists
// Function prototypes
void Delay_millisec(unsigned int time_del);
void switch_ISR(void);
int main(void) {
// Initialize peripherals, including LEDs and a switch.
// Assume the switch is connected to INT0 pin
LEDs_Init();
INT0_Init(&switch_ISR);
while (flag == 0) {
// Turn off all LEDs.
LEDs_Off(LED_ALL);
// Wait for a random amount of time between 1 and 3 seconds using the rand() function.
int delay_time = (rand() % 3) + 1;
Delay_millisec(delay_time * 1000);