Created
January 23, 2022 02:51
-
-
Save matschaffer/3bad562d204f14e8087531097e5a3c85 to your computer and use it in GitHub Desktop.
Circuit Playground Express - Morse generator
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
#include <Adafruit_CircuitPlayground.h> | |
void setup() { | |
CircuitPlayground.begin(10); | |
CircuitPlayground.clearPixels(); | |
pinMode(A1, INPUT_PULLUP); | |
} | |
void loop() { | |
if (digitalRead(CPLAY_LEFTBUTTON) || !digitalRead(A1)) { | |
if (CircuitPlayground.slideSwitch()) { | |
tone(CPLAY_BUZZER, 600); | |
} | |
for (int i = 0; i < 10; i++) { | |
CircuitPlayground.setPixelColor(i, 50, 10, 255); | |
} | |
while (digitalRead(CPLAY_LEFTBUTTON) || !digitalRead(A1)) { | |
delay(10); | |
} | |
} else { | |
CircuitPlayground.clearPixels(); | |
noTone(CPLAY_BUZZER); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment