Some consistency in spacing

This commit is contained in:
Paul Warren 2017-02-11 21:11:16 +11:00
parent 41cf282c71
commit c32a347c1a
1 changed files with 3 additions and 42 deletions

View File

@ -1,4 +1,5 @@
import time
from playsound import playsound
class Morse:
@ -10,7 +11,6 @@ class Morse:
getattr(self, 'morse_' + alphanum)()
self.wait_letter()
def play_string(self, letters):
for letter in letters:
if letter == ' ':
@ -19,17 +19,14 @@ class Morse:
print letter
self.play_letter(letter)
def play_sound(self, alphanum):
pass
playsound("./audio/"+alphanum.upper()+".mp3", false)
##################################################
# Dahs and Dits arrived at by trial and error
# Feel free to find one that works for you!
# see http://www.ti.com/lit/ds/symlink/drv2605.pdf for more info!
##################################################
def dah(self):
self.drv.setWaveform(0, 14)
self.drv.setWaveform(1, 0)
@ -51,143 +48,107 @@ class Morse:
def morse_a(self):
self.dit(); self.dah();
def morse_b(self):
self.dah(); self.dit(); self.dit(); self.dit();
def morse_c(self):
self.dah(); self.dit(); self.dah(); self.dit()
def morse_d(self):
self.dah(); self.dit(); self.dit();
def morse_e(self):
self.dit();
def morse_f(self):
self.dit(); self.dit(); self.dah(); self.dit();
def morse_g(self):
self.dah(); self.dah(); self.dit();
def morse_h(self):
self.dit(); self.dit(); self.dit(); self.dit();
def morse_i(self):
self.dit(); self.dit();
def morse_j(self):
self.dit(); self.dah(); self.dah(); self.dah();
def morse_k(self):
self.dah(); self.dit(); self.dah();
def morse_l(self):
self.dit(); self.dah(); self.dit(); self.dit();
def morse_m(self):
self.dah(); self.dah();
def morse_n(self):
self.dah(); self.dit();
def morse_o(self):
self.dah(); self.dah(); self.dah();
def morse_p(self):
self.dit(); self.dah(); self.dah(); self.dit();
def morse_q(self):
self.dah(); self.dah(); self.dit(); self.dah();
def morse_r(self):
self.dit(); self.dah(); self.dit();
def morse_s(self):
self.dit(); self.dit(); self.dit();
def morse_t(self):
self.dah();
def morse_u(self):
self.dit(); self.dit(); self.dah();
def morse_v(self):
self.dit(); self.dit(); self.dit(); self.dah();
def morse_w(self):
self.dit(); self.dah(); self.dah();
def morse_x(self):
self.dah(); self.dit(); self.dit(); self.dah();
def morse_y(self):
self.dah(); self.dit(); self.dah(); self.dah();
def morse_z(self):
self.dah(); self.dah(); self.dit(); self.dit();
def morse_1(self):
self.dit(); self.dah(); self.dah(); self.dah(); self.dah();
def morse_2(self):
self.dit(); self.dit(); self.dah(); self.dah(); self.dah();
def morse_3(self):
self.dit(); self.dit(); self.dit(); self.dah(); self.dah();
def morse_4(self):
self.dit(); self.dit(); self.dit(); self.dit(); self.dah();
def morse_5(self):
self.dit(); self.dit(); self.dit(); self.dit(); self.dit();
def morse_6(self):
self.dah(); self.dit(); self.dit(); self.dit(); self.dit();
def morse_7(self):
self.dah(); self.dah(); self.dit(); self.dit(); self.dit();
def morse_8(self):
self.dah(); self.dah(); self.dah(); self.dit(); self.dit();
def morse_9(self):
self.dah(); self.dah(); self.dah(); self.dah(); self.dit();
def morse_0(self):
self.dah(); self.dah(); self.dah(); self.dah(); self.dah();