Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from time import sleep
- from IoTPy.interfaces.gpio import GPIO
- from time import time
- _UPER1 = 1
- _LPCexpresso = 2
- ioBoardType = _LPCexpresso
- LED_PIN_ID_1 = 'D6'
- from IoTPy.boards.metis import Metis as ioBoard
- number = []
- message = []
- phrase = input()
- word = list(phrase)
- delta = 0.005
- for num in word:
- number.append(ord(num))
- for var in number:
- message.append("{0:{fill}8b}".format(var, fill=0))
- bits = [int(b) for b in ''.join(message)]
- proto_sequence = bits + [0]
- print(bits)
- print(message)
- with ioBoard() as board, board.digital(LED_PIN_ID_1) as ledPin1:
- ledPin1.setup(GPIO.OUTPUT)
- ledPin1.write(1)
- next_moment = (time() + 0.3)
- sleep(next_moment - time())
- for bit in proto_sequence:
- ledPin1.write(bit)
- next_moment += delta
- sleep(next_moment - time())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement