From f70e6d47a95ac42a6e26838c7a76fb6aaae94b9d Mon Sep 17 00:00:00 2001 From: Collin Cunningham Date: Mon, 18 Dec 2017 23:45:25 -0500 Subject: [PATCH] Update main.py change function ordering for better legibility --- Morse_Code_Flasher/main.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Morse_Code_Flasher/main.py b/Morse_Code_Flasher/main.py index 9c7669cb3..89753b67f 100644 --- a/Morse_Code_Flasher/main.py +++ b/Morse_Code_Flasher/main.py @@ -33,19 +33,6 @@ class MorseFlasher: else: 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) @@ -72,6 +59,19 @@ class MorseFlasher: output += " " #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)