This project is a great starting point for learning to code for the Circuit Playground Express. Consider modifying it to make it your own.
Here's some ideas for changes you can make and some tips on how to make them in CircuitPython:
By default, the code will display Morse code for "SOS", but you can easily customize it with any capital letters or numbers. To do so, Modify this line:
message = 'SOS'
Simply replace SOS with your message - just be sure to use only capital letters or numbers:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9 0
(Note that the MakeCode version of the code will only display letters, not numbers)
The color and brightness of the LEDs can be changed by modifying these two lines in the CircuitPython code:
flash_color = (255, 0, 0) # Color of the morse display.
brightness = 0.5 # Display brightness (0.0 - 1.0)
The flash_color numbers represent the amount of (Red, Green, Blue) mixed together to create the final displayed color. They can be any whole number between 0 and 255.
The brightness value changes how much of the flash_color is displayed. It can be set to a decimal value between 0.0 and 1.0
The duration of LED flashes and the gap between them can all be changed with this line:
dot_length = 0.15 # Duration of one Morse dot
The dot_length value represents time in seconds, so changing 0.15 to 1.0 will make each 'dot' flash last one whole second - which is pretty long for morse code!
Once you feel comfortable making changes to the code, try making some more advanced modifications like these:
- Set the display to only trigger after pressing one of the built-in buttons
- Set a different message to display for each button pressed
- Add an audio tone which plays in sync with the LEDs