2022-04-19T19:58:40

This commit is contained in:
2022-04-19 19:58:41 +09:00
parent 25752057b1
commit f405181219
26 changed files with 632 additions and 7 deletions

30
05_time/src/time.c Normal file
View File

@@ -0,0 +1,30 @@
#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/time.h"
#include "hardware/timer.h"
#include "hardware/gpio.h"
#include "pico/binary_info.h"
const uint LED_PIN = PICO_DEFAULT_LED_PIN;
int main()
{
bi_decl(bi_program_description("Time"));
bi_decl(bi_1pin_with_name(LED_PIN, "On-board LED"));
stdio_init_all();
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
while (true)
{
printf("%u %u\n", to_us_since_boot(get_absolute_time()), time_us_32());
gpio_put(LED_PIN, true);
sleep_ms(250);
gpio_put(LED_PIN, false);
sleep_ms(2000);
}
}