-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBasic.ino
More file actions
31 lines (25 loc) · 767 Bytes
/
Basic.ino
File metadata and controls
31 lines (25 loc) · 767 Bytes
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
29
30
31
#include <anyrtttl.h>
#include <binrtttl.h>
#include <pitches.h>
// Define the BUZZER_PIN for current board
#if defined(ESP32)
#define BUZZER_PIN 25 // Using GPIO25 (pin labeled D25)
#elif defined(ESP8266)
#define BUZZER_PIN 2 // Using GPIO2 (pin labeled D4)
#else // base arduino models
#define BUZZER_PIN 9
#endif
//project's constants
const char * tetris = "tetris:d=4,o=5,b=160:e6,8b,8c6,8d6,16e6,16d6,8c6,8b,a,8a,8c6,e6,8d6,8c6,b,8b,8c6,d6,e6,c6,a,2a,8p,d6,8f6,a6,8g6,8f6,e6,8e6,8c6,e6,8d6,8c6,b,8b,8c6,d6,e6,c6,a,a";
void setup() {
pinMode(BUZZER_PIN, OUTPUT);
Serial.begin(115200);
Serial.println();
}
void loop() {
anyrtttl::blocking::play(BUZZER_PIN, tetris);
while(true)
{
delay(1); // prevent watchdog from reseting the board
}
}