Skip to content
Snippets Groups Projects
Commit 0283c0b5 authored by cf2g21's avatar cf2g21
Browse files

Upload skeleton.c

parent be541679
No related branches found
No related tags found
No related merge requests found
#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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment