Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
amicojeko committed Dec 30, 2020
1 parent e8d23ca commit 61ed743
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ void setup() {
; // wait for serial port to connect. Needed for native USB
}
Serial.begin(115200);


}

void loop() {
Expand All @@ -59,40 +57,6 @@ void loop() {
}

if (digitalRead(RESET_PIN) == LOW) {
// display.reset();
// display.print("LAAZ");


// 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);

display.print('2');
display.reset();
}

// display.print('2');
}
66 changes: 66 additions & 0 deletions examples/split_flap_song/split_flap_song.ino
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);
}
}

0 comments on commit 61ed743

Please sign in to comment.