Programme morse pour tester les fonctions de MU
## Morse - Kojiverse Productions from math import * from mu import * from time import * code = {'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':'--..', ' ':'/',} blinkDuration = {'.':0.5,'-':1,'/':0,} doMorse = lambda txt: ''.join([code[i.lower()]+'/' for i in txt if i.isalpha() or i==chr(32)])[:-1] blinkLED = lambda el: [set_led((255,0,0)),sleep(blinkDuration[el]),set_led((0,0,0))] blink = lambda txt: [[blinkLED(i),sleep(0.5 if i!='/' else 1.5)] for i in '-//'+txt] blink(doMorse(input('TXT : '))) ## Morse programme to test set_led() ## function and having fun