# coding: utf-8 import dicomatrice2D import comMorse print("tape un code morse") code = input() reponse = comMorse.decode(code) dicomatrice2D.testMatrice2D(reponse)
import dicoMatrice2D import comMorse import ledArduino print("tape une lettre") lettre = input() reponseMorse = comMorse.encode(lettre) print("le code morse est :", reponseMorse) reponse = comMorse.decode(reponseMorse) ledArduino.envoiCaractere(reponse)
import network import comMorse import ledArduino ADDRESS = "10.0.0.116" PORT = 1111 socket = network.newServerSocket() socket.bind((ADDRESS, PORT)) while True: socket.listen(10) print("en ecoute...") thread = network.newThread(socket.accept()) thread.start() #notre communication message = thread.clientsocket.recv(4096) morse = message.decode("utf-8") print("message reçu :", morse) lettre = comMorse.decode(morse) print("message traduit :", lettre) ledArduino.envoiCaractere(lettre) thread.clientsocket.send("j'ai bien reçu le message".encode())