> For the complete documentation index, see [llms.txt](https://cavedu.gitbook.io/cavedu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cavedu.gitbook.io/cavedu/hangeekduino/samplecode/output_module/led.md).

# LED模組

![](/files/-MHKpVK0lmzSeCyGJl_z)

## **指令**

![](/files/-MIHx-R2gad43-v2FN8G)

## **對應的**Arduino 語法

```
  digitalWrite(4, 1);
```

### 範例 BlocklyDuino 積木畫布

將4號腳位的電位拉低、拉高，每一秒鐘會切換LED的亮暗一次。

![](/files/-MIHwsGisl6rxlEe9YyA)

## Arduino 程式

```
void setup()
{
  pinMode(4, OUTPUT);

}


void loop()
{
  digitalWrite(4, 1);
  delay(1000);
  digitalWrite(4, 0);
  delay(1000);
}
```

## 影片教學:

{% embed url="<https://www.youtube.com/watch?v=KFWztn425cA>" %}
