From 0283c0b5591cb1624539ec16474a2aca64489b8b Mon Sep 17 00:00:00 2001
From: cf2g21 <cf2g21@soton.ac.uk>
Date: Sun, 14 May 2023 12:10:39 +0000
Subject: [PATCH] Upload skeleton.c

---
 skeleton.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 skeleton.c

diff --git a/skeleton.c b/skeleton.c
new file mode 100644
index 0000000..da5bddb
--- /dev/null
+++ b/skeleton.c
@@ -0,0 +1,48 @@
+#include "pico/stdlib.h"
+#include "hardware/pwm.h"
+#include "hardware/clocks.h"
+
+const int FIRST_LED_PIN = 0;
+const int LAST_LED_PIN = 28;
+const int BUZZER_PIN = 18;
+
+void sound_buzzer() {
+    gpio_set_function(BUZZER_PIN, GPIO_FUNC_PWM);
+    uint slice_num = pwm_gpio_to_slice_num(BUZZER_PIN);
+
+// TODO: Sound the buzzer using PWM
+
+    pwm_set_enabled(slice_num, true);
+    sleep_ms(200);  // Sound the buzzer for 200 milliseconds
+    pwm_set_enabled(slice_num, false);
+}
+
+// Pins that are not LEDs
+bool valid_led(int pin) {
+    if (pin == 23 || pin == 24 || pin == 25) {
+        return false;
+    } else {
+        return true;
+    }
+}
+
+
+int main() {
+    stdio_init_all();
+
+    // TODO: Initialise LED pins as output
+
+
+    // TODO: Turn on all LEDs
+
+    // Initial wait
+    sleep_ms(1000);
+
+    // TODO: Turn off each LED one by one each second
+
+
+    sound_buzzer();
+
+
+    return 0;
+}
-- 
GitLab