Language Switcher

Turn on an LED when pressing a button [Block Program]

Make things

Turn on an LED with an obniz Board.
This time, build a control button on a browser, and turn on an LED when pressing it, by Block Programming.


How to make

Hardware connection

In the same way as Turning on an LED, connect the LED to the obniz Board.


1. Connect the LED

Use “led wired on obniz” block and “Turn on led” block from Light item.

Reference: Turn on an LED

2. Create a button

Use “Create button with ‘text’” block from UI item.

This block create a button on a browser.
“text” is what is displayed on the button. You can change it as you like.

In this example, change text into “ひかる, ” which means “light” in Japanese.

3. If the button is pressed, turn on the LED

Use “if <> do” block from Logic item to set if A then B.

 It is called "if statement" that if A is true, then performs B.

Rhombus blocks (condition) can be insert into the place of true.

This time, put the condition of “button clicked” from UI.

Then, repeat do the if block.