Button Controlled LED


In this tutorial you will learn how to model a push button using the inventone board. You'd be using the inventone board to control an LED based on the state of a push button.


List of Component


Push button

2x resistors

Bread board

Jumper wires

InventOne dev. Board


NB: You can get most of the components from any online store aliexpresshub360, or ebay. Click here to order for your inventone boards.



The image below shows the circuit connection which we have designed using fritzing. Take note of the pin numbers when making your connections else you'd have issues while trying to carryout this project. Here we are powering the LED using 3.3V from the inventone board, hence we need a resistor to safeguard the LED from getting damaged.  Next one of the legs of the push button is connected to 3.3V and the other leg is connected to ground via a resistor, this ensures that we don’t mistakenly have a high voltage level on the inventone pin. When the push button is pressed, all the legs of the push button are bridged, this allows a high voltage level appear on the inventone pin. The board has been programed such that when a high voltage level appears on the button’s pin, it writes a high to the leg of the LED turning it ON in the process. See code section for more info on the program running on the board.

Circuit diagram for a Button Controlled LED
Button Controlled LED schematic



The LED and Button pins are defined as pins 12 and 13 respectively, in the setup we establish the nature of the pins, LED pin is an output pin which we would be using to drive the LED while Button pin is an input pin. To enable serial communication between the inventone board and your PC, we call the Serial.begin( ) function which effectively begins serial communication at the specified rate.

The loop handles reading the button’s output, checking if it is a high or low; if it is high we write a high to the LED pin and print “LED is ON” on the serial monitor else, we ensure the LED doesn’t come ON by writing a low to it and we print “LED is OFF” on the serial monitor.

Since we want the board to respond pretty fast to whatever voltage level appears on the button pin, we set no delay and allow the board to constantly read the button's pin.


/*This code controls LED using a button and inventone dev. board
* Please connect 10k resistor to protect LED from getting burnt
If using a push button, connect a pull down resistor to the other
leg of the push button to give uptimum performance
//Define pins for LED and button
int LED = 12;
int Button = 13;

void setup() {
  pinMode(LED, OUTPUT);
  pinMode(Button, INPUT);
  //Begin serial monitor communication

void loop() {
  //Check if button has been pressed
  if(digitalRead(Button) == HIGH){
    digitalWrite(LED, HIGH);
    Serial.println("LED is ON");
  else {
    //Ensure that LED doesn't come ON
    digitalWrite(LED, LOW);
    Serial.println("LED is OFF");




For more info on the working principle of the push button check out Wikipedia. Also if you are having any issue trying to implement this project do well to contact any of our engineers here at inventech we'd be more than glad to render our assistance.