Skip to content


전자 기타 1 - 터치 멜로디

고급 | MakeCode, Python | 사운드, | 사운드, 입력/출력, 전기, 전자공학

1단계: 만들어 보세요.

프로젝트 소개

Play different tunes by using the micro:bit’s touch sensor.

다음 동영상을 통해 만들고 프로그래밍하는 방법을 살펴보세요.:


프로그래밍 가이드


  • This project is the same as the Jukebox project but instead of using the micro:bit’s buttons, you’ll make your own input device using cardboard covered in strips of tin foil connected by crocodile clip leads to the micro:bit's pins.
  • Flash the program onto your micro:bit.
  • Attach one end of three crocodile clip leads to pins 1, 2 and GND (ground or Earth pin). Attach the other ends to a cardboard guitar or keyboard.
  • With one finger touch the foil connected to GND, and with another finger touch the foil connected to pin 1 and then pin 2. It should play a different tune depending on which strip of foil you touch.
  • The micro:bit is using pins 1 and 2 as touch inputs. When you touch either of these pins and the GND pin, you’re completing an electrical circuit. A small amount of electricity flows through you, the micro:bit can detect it and the program triggers the playing of a tune.
  • If you do not have a V2 micro:bit, which plays sound, attach headphones to pins 0 and GND.
알루미늄 호일 조각들과 micro:bit 의 1번, 2번, GND 핀을 연결하는 방법에 대한 사진


  • micro:bit 와 배터리 팩 (옵션)
  • MakeCode 또는 Python 편집기
  • three crocodile clip leads
  • cardboard, tin foil, glue stick and scissors to make a guitar or keyboard
  • optional headphones, buzzer, or speaker with additional two crocodile clip leads for V1 users

2단계: 프로그래밍 해보세요.

1from microbit import *
2import music
4while True:
5    if pin1.is_touched():
7    if pin2.is_touched():

3단계: 더 좋게 만들어 보세요.

  • Change the tunes that are played when you touch the tin foil.
  • 자신만의 멜로디를 작성해 넣어 보세요.
  • Show different pictures, letters, numbers, or words depending on which tune you picked.