-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
67 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#include <SplitFlapDisplay.h> | ||
|
||
// Delay between palette flaps. 80 is a safe value | ||
#define FLAP_DELAY 80 | ||
|
||
// Reset button pin. Doesn't require additional pull up resistors | ||
#define BUTTON_PIN 12 | ||
|
||
// Number of display letters | ||
#define DISPLAY_LENGTH 2 | ||
|
||
#define LONG_NOTE 500 | ||
#define SHORT_NOTE 250 | ||
|
||
// Relay pins of the single letters | ||
int letterPins[] = {10, 11}; | ||
|
||
// Hall sensor pins of the single letters | ||
// They must follow the same order of letterPins | ||
int hallPins[] = {6, 7}; | ||
|
||
// Buffer used to send the serial data to the display | ||
char buf[DISPLAY_LENGTH]; | ||
|
||
// Initialize the display object | ||
SplitFlapDisplay display(DISPLAY_LENGTH, letterPins, hallPins, FLAP_DELAY); | ||
|
||
void setup() { | ||
/// Initialize the reset pin | ||
pinMode(BUTTON_PIN, INPUT_PULLUP); | ||
} | ||
|
||
void loop() { | ||
display.refresh(); | ||
|
||
if (digitalRead(BUTTON_PIN) == LOW) { | ||
|
||
display.flap(); | ||
delay(LONG_NOTE); | ||
display.flap(); | ||
delay(LONG_NOTE); | ||
|
||
display.flap(); | ||
delay(SHORT_NOTE); | ||
display.flap(); | ||
delay(SHORT_NOTE); | ||
display.flap(); | ||
delay(LONG_NOTE); | ||
|
||
display.flap(); | ||
delay(SHORT_NOTE); | ||
display.flap(); | ||
delay(SHORT_NOTE); | ||
display.flap(); | ||
delay(SHORT_NOTE); | ||
display.flap(); | ||
delay(LONG_NOTE); | ||
|
||
display.flap(); | ||
delay(SHORT_NOTE); | ||
display.flap(); | ||
delay(LONG_NOTE); | ||
|
||
delay(5000); | ||
} | ||
} |