pxt-maker
Version:
Microsoft MakeCode Maker Boards
60 lines (39 loc) • 1.33 kB
Markdown
# Blinky
## Introduction @unplugged
Turn on and off the light pin to create a blinking effect.

```template
forever(function() {
})
```
## Step 1 @fullscreen
Add a ``||pins:digital write||`` to turn the ``D0`` pin ``LOW``.
```blocks
forever(function() {
pins.D0.digitalWrite(false)
})
```
## Step 2 @fullscreen
Take a peek at the simulator and make sure the LED is turned off.

## Step 3 @fullscreen
Add another ``||blocks:pause||`` and ``||pins:digital write||`` to create a blinking effect.
Make sure the digital write is **HIGH**.
```blocks
forever(function() {
pins.D0.digitalWrite(false)
pause(500)
pins.D0.digitalWrite(true)
pause(500)
})
```
Play with the duration in your pauses to create different patterns.
## Step 4 @fullscreen
Look at the simulator and make sure your program works as expected.
If you have a @boardname@, press ``|Download|`` and follow the instruction to get your code on your device.
Click on the **wrench** icon under the simulator to get detailed breadboarding instructions.

```config
feature=uf2
feature=pind0
```