From 2d5ad1d6f47c84c63b7b64e29fc2116c3fa2b8fa Mon Sep 17 00:00:00 2001 From: Lea Date: Wed, 30 Aug 2023 16:08:44 +0200 Subject: [PATCH] beep every second --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 32ecf46..18cc99f 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,7 @@ #define __AVR_ATmega2560__ #define F_CPU 16000000UL #define DISPLAY PORTF +#define TICK_BEEP true #include #include @@ -36,7 +37,10 @@ void start_timer() { // is triggered whenever timer 1 (16 bit) overflows. ISR(TIMER1_OVF_vect) { TCNT1 = tick_timer_start; - if (counting) ticks += 1; + if (counting) { + ticks += 1; + if (TICK_BEEP && ticks % 1000 == 0 && !beep_time) beep_time = 10; + } if (bit_is_set(PIND, PIND0)) { PORTD &= 0b11111110;