Update main.py
change function ordering for better legibility
MODIFY
Morse_Code_Flasher/main.py
Morse_Code_Flasher/main.py
@@ -34,19 +34,6 @@ class MorseFlasher:
pixels.fill((0,0,0))
pixels.show()
- def display(self, code=".-.-.- "):
- # iterate through morse code symbols
- for c in code:
- # show a dot
- if c == ".":
- self.showDot()
- # show a dash
- elif c == "-":
- self.showDash()
- # show a gap
- elif c == " ":
- time.sleep(character_gap)
-
def showDot(self):
self.light(True)
time.sleep(dot_length)
@@ -73,6 +60,19 @@ class MorseFlasher:
#save complete morse code output to display
self.display(output)
+ def display(self, code=".-.-.- "):
+ # iterate through morse code symbols
+ for c in code:
+ # show a dot
+ if c == ".":
+ self.showDot()
+ # show a dash
+ elif c == "-":
+ self.showDash()
+ # show a gap
+ elif c == " ":
+ time.sleep(character_gap)
+
# Initialize NeoPixels
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=False)
pixels.fill((0, 0, 0))

Update main.py

change function ordering for better legibility