From a7d780eaf55cdf3e9afd5ea02a05141ceff479b0 Mon Sep 17 00:00:00 2001 From: Uttam Ambappa Bhavimani Date: Sun, 22 Sep 2024 19:50:13 +0530 Subject: [PATCH] Update Group21_Lab06_Task2/main.c Initialize Duty Cycle --- Group21_Lab06_Task2/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Group21_Lab06_Task2/main.c b/Group21_Lab06_Task2/main.c index 3b000fc..b78af4e 100644 --- a/Group21_Lab06_Task2/main.c +++ b/Group21_Lab06_Task2/main.c @@ -1,3 +1,8 @@ #include #include -#include "tm4c123gh6pm.h" \ No newline at end of file +#include "tm4c123gh6pm.h" +// Global Variables +volatile int duty = 50; // Initial duty cycle +volatile bool buttonPressed = false; // Track button state +volatile uint32_t pressDuration = 0; // Track how long the button is pressed +const long int PWM_PERIOD = 1000000; // Period for 100kHz in microseconds (10ms)