diff --git a/skeleton.c b/skeleton.c new file mode 100644 index 0000000000000000000000000000000000000000..da5bddb211eeb047dded7da0fc5b0f1c92df292d --- /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; +}