Webduino 模擬器:按鈕控制LED亮滅 (Webduino Simulator: Control a LED with a Button)

若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。

If you like this post, please click the ads on the blog or buy me a coffee. Thank you very much.

這次換用 Webduino 模擬器上的按鈕來控制 LED 燈。
This tutorial will control a LED with a button. 

模擬器的接線方式,為一顆 LED ,長腳接D13,短腳接GND。(注意:實際硬體的LED燈是需要接上電組的,不然LED燈有可能會燒掉。)以及一個按鈕,S接D10,V接5V,G接GND。

Wiring:
  1. LED anode --> UNO D13
  2. LED cathode --> UNO GND
  3. Button S(signal) --> UNO D10
  4. Button V(voltage) --> UNO 5V
  5. Button G(ground) --> UNO GND


The circuit design is the following diagram. (Note: a resistor is needed for physical wiring to avoid destroying a LED.)



程式積木部分為:
The code:



影片 (Demo Video):

沒有留言: