mBlock 單元六:傾斜感測器之搖搖樂 ( mBlock Unit 6: Shake it with a Tilt Switch )

Ping-Lun Liao
2 min readNov 20, 2018

--

本文所用的Tilt Sensor為SW-520D,此感測器在網路上找到的名稱有滾珠開關、震動開關、傾斜開關等,有點讓我混亂,但不管名稱為何,可用它的特性來做搖搖樂。

Arduino 電路圖如下:

硬體材料:

  1. Arduino UNO R3 板子 x 1
  2. 公對公杜邦線 x 4
  3. LED燈 x 1 4. 220歐姆電阻 x 2
  4. Tilt Sensor x 1

mBlock 程式積木如下:

注意:程式積木寫法不是只有上面一種,這只是筆者偷懶的寫法。

示範影片:

Originally published at yunlinsong.blogspot.com on November 20, 2018.

--

--

No responses yet