Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from microbit import * # 마이크로비트 모듈의 모든 명령 사용
- import radio # 라디오 모듈 사용
- radio.on() # 라디오 기능 활성화
- while True: # 무한 반복
- if button_a.was_pressed(): # A버튼을 누르면
- sleep(500)
- if button_a.is_pressed():
- radio.send('dot') # ‘dot’ 전송
- display.show(Image('00000:00000:00900:00000:00000'))
- sleep(500)
- display.clear()
- sleep(300)
- else:
- radio.send('dash') # ‘dash’ 전송
- display.show(Image('00000:00000:99999:00000:00000'))
- # 디스플레이에 도트(·) 출력
- sleep(500)
- display.clear()
- sleep(300)
- r = radio.receive() # 여기서 부터는 수신 기능 코드
- if r == 'dot':
- display.show(Image('00000:00000:00900:00000:00000')) # 디스플레이에 대시(-) 출력
- sleep(500)
- display.clear()
- sleep(300)
- elif r == 'dash':
- display.show(Image('00000:00000:99999:00000:00000'))
- sleep(500)
- display.clear()
- sleep(300)
Add Comment
Please, Sign In to add comment