-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuzz.cpp
28 lines (26 loc) · 922 Bytes
/
buzz.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
©LPD Lawrence Link 2021
All rights reserved
Geiger Counter N1
Licensed under GNU General Public License v3.0
-------CONTACT AT-------
*/
#include "global.h"
#include <Arduino.h>
#define TIME_ELAPSE_COEFFICIENT 0.8
void toneSOS(){
static int i;
i++;
/* Not a clever way to do task managing */
/* BUT It works anyway */
if (i == TIME_ELAPSE_COEFFICIENT * 50 || i == TIME_ELAPSE_COEFFICIENT * 60 || i == TIME_ELAPSE_COEFFICIENT * 70 || i == TIME_ELAPSE_COEFFICIENT * 130 || i == TIME_ELAPSE_COEFFICIENT * 140 || i == TIME_ELAPSE_COEFFICIENT * 150)
tone(PIN_BUZZER, 1000, 60); // shorter beep
if (i == TIME_ELAPSE_COEFFICIENT * 80 || i == TIME_ELAPSE_COEFFICIENT * 100 || i == TIME_ELAPSE_COEFFICIENT * 120)
tone(PIN_BUZZER, 1000, 120); // longer beep
if (i > TIME_ELAPSE_COEFFICIENT * 260)
i = 0;
}
void toneClick(){
tone(PIN_BUZZER, 1000, 15);
}