-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharduino-music.ino
66 lines (40 loc) · 921 Bytes
/
arduino-music.ino
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
Melody
Plays a melody
circuit:
* 8-ohm speaker on digital pin 8
created 21 Jan 2010
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
http://arduino.cc/en/Tutorial/Tone
*/
#include "Scale.h"
#include "Rhythm.h"
#include "Song.h"
#ifndef _include_libs_i2clcd_
#define _include_libs_i2clcd_
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#endif;
#define ANALOG_OPEN 0
Scale *s;
Rhythm *r;
void setup() {
Serial.begin(9600);
randomSeed(analogRead(ANALOG_OPEN));
LED::Initialize();
Display::Initialize();
uint8_t major[] = {2, 2, 1, 2, 2, 2, 1};
Serial.print("Initializing scale... ");
s = new Scale(0, major, 7);
Serial.print("done.\n");
Serial.print("Initializing rhythm... ");
r = new Rhythm(4, 4, 100);
Serial.print("done.\n");
s->print_debug();
r->print_debug();
}
void loop() {
Song::loop_Play(s, r);
}