Skip to content

Instantly share code, notes, and snippets.

@matschaffer
Created January 23, 2022 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matschaffer/3bad562d204f14e8087531097e5a3c85 to your computer and use it in GitHub Desktop.
Save matschaffer/3bad562d204f14e8087531097e5a3c85 to your computer and use it in GitHub Desktop.
Circuit Playground Express - Morse generator
#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