HariboteOS/day27/app/beepdown.c
2021-05-29 23:13:17 +08:00

21 lines
297 B
C

#include "api.h"
int main() {
int timer = api_alloc_timer();
api_init_timer(timer, 128);
for (int i = 20000000; i >= 20000; i -= i / 100) {
api_beep(i);
api_set_timer(timer, 1);
if (api_get_key(1) != 128) {
break;
}
}
api_beep(0);
api_end();
return 0;
}