Skip to content

活动

导电性测试仪

中级 | MakeCode | LED显示器, 声音, 引脚 | 电力, 迭代, 选择

第 1 步:制作

它是什么?

使用您的micro:bit和两条鳄鱼夹线来探究材料的导电性——轻松完成一个简单的科学实验!

如何使用

  • 将下面的代码上传到您的micro:bit,或者跟随视频自己完成代码的编写。
  • micro:bit的底部有五个大的触点。 当您将1号引脚和GND地线引脚用鳄鱼夹线连接起来,就形成了电流通路
  • 安全须知不要将GND和3V引脚直接连接起来,否则可能损坏您的micro:bit
  • If you attach two crocodile clip leads, one to pin 1 and one to the GND pin, you can put a material such as silver foil or cling film between the ends of the two leads to test if the material is conductive or an insulator.

工作原理

  • The project uses selection. If an electrical circuit is made (because the material conducts) then the micro:bit will show a heart on its LED display and play the note Middle C.
  • Else, if a circuit is not made, the micro:bit will clear its LED display and a note will not play - the micro:bit is instructed to play a note at a frequency of 0Hz.
  • The program uses a forever or infinite loop to keep on testing until you disconnect your micro:bit from a power supply.

所需材料

  • micro:bit (or MakeCode simulator)
  • MakeCode编辑器
  • 电池组(推荐,可选)
  • our pins introduction video may be useful

You may like

The Conductivity tester recording sheet can be used to record which materials conduct and which do not in a classroom or coding club.

Conductivity tester recording sheet
Download the recording sheet

第 2 步:编程

1from microbit import *
2import music
3
4while True:
5    if pin1.is_touched():
6        display.show(Image.HEART)
7        music.play('c')
8    else:
9        display.clear()

第3步:完善

  • Adjust the code to show a different icon or play a different sound if the material is conductive.
  • Try out a wide range of materials with your conductivity tester such as pencil graphite, PlayDoh, and dry and damp tissue paper.
  • It can be fun to use a human being as the test material! Simply hold the crocodile clip leads in both hands, or form a human chain.