Switchy
Introduction
Attach a switch on a digital pin to turn a LED on or off.
forever(function () {
})
Step 1
Add ||pins:digital write||
under the ||loops:forever||
to set pin D1 to LOW
(false).
forever(function () {
pins.D1.digitalWrite(false)
})
Step 2
Add ||pins:digital read||
in the LOW
/HIGH
slot. Change the pin to D0.
forever(function () {
pins.D1.digitalWrite(pins.D0.digitalRead())
})
Step 3
Look at the simulator and test if your program works as you would expect. If you move the switch, the LED should turn on and off.
Step 4
Click ||Download||
to download your code into your board and click the wrench to get detailled
breadboarding instructions.
feature=uf2
feature=pind0
feature=pind1