-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSong.h
49 lines (40 loc) · 1010 Bytes
/
Song.h
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
#ifndef MODE_SONG
#define MODE_SONG
#include "Colors.h"
// ------------------------------------------------------------------
// FEATURE PROTOTYPES
// ------------------------------------------------------------------
void setupFeature();
void runFeature();
// ------------------------------------------------------------------
// FEATURE IMPLEMENTATIONS
// ------------------------------------------------------------------
#define SONG_PIN 3
int colorsIndex[] = {INDEX_COLOR_RED, INDEX_COLOR_GREEN, INDEX_COLOR_BLUE,
INDEX_COLOR_PURPLE, INDEX_COLOR_YELLOW, INDEX_COLOR_WHITE};
int colorIndex = colorsIndex[0];
void incrementIndex()
{
if (colorIndex == INDEX_TURN_OFF)
{
colorIndex = 0;
}
else
{
colorIndex++;
}
}
void setupFeature()
{
pinMode(SONG_PIN, INPUT);
}
void runFeature()
{
if (digitalRead(SONG_PIN) == HIGH)
{
selectColorByIndexMode(colorIndex);
incrementIndex();
delay(1000);
}
}
#endif