How to Create a Button controlled LED Project

In this tutorial, we will guide you through creating a simple button controlled LED project using OmniBoard Studio.


Steps to Create a Button controlled LED Project

1

Open OmniBoard Studio and create a new project.

2

Drag and drop the necessary blocks to create a simple circuit that controls an LED with a button.

Try to explore and make the diagram you self or click here and find out one of the solutions.
  • Place Start block.
  • Connect the Start block to a While True block to create an infinite loop.
  • Then connect the While True block to a Button block. This will allow us to check the state of the button.
  • Finally connect the True output of the Button block to a LED ON block. This will cause the LED to turn on. To the False output connect a LED OFF block. This will cause the LED to turn off.
3

Make the correct circuit

  • Connect the button to the correct GPIO pin on your microcontroller. This will allow the Button block to read the state of the button correctly. Your usual button will have two pairs of pins. You will need to connect one pair to a GPIO pin and the other pair to 3.3V.
  • Now you can try to connect the LED from memory because the circuit is the same as in the previous tutorial. Or click to reveal the circuit diagram and instructions.
  • Click to reveal the circuit diagram and instructions
    • Connect the GPIO pin asigned to the LED to the rezistor.
    • Connect the positive leg of the LED to a resistor, and then connect the other end of the LED to ground. You can determine which leg is positive and which is negative by finding the longer leg (positive) and shorter leg (negative) or flat side of the LED cover (negative).
    • Button controlled LED Circuit
4

Compile the code and upload it to your microcontroller.

5

Watch your LED blink on and off at the interval you set with the Timer block!

Bonus informations