Introduction: Visuino How to Use a Button As an Input to Control Things Like LED

About: Arduino fan!

In this tutorial we will learn how to Turn the LED ON and OFF using a simple button and Visuino.

Watch a demonstration video.

Step 1: What You Will Need

  1. Arduino UNO (or any other Arduino)
  2. Jumper wires
  3. Button
  4. LED
  5. Resistor 1k ohm (or something similar)
  6. Breadboard
  7. Visuino program: Download Visuino

Step 2: The Circuit

  1. Connect Arduino Pin 5V to breadboard positive pin (red line)
  2. Connect Arduino Pin GND to breadboard negative pin (blue line)
  3. Connect Arduino Digital pin 13 to LED positive pin
  4. Connect LED negative pin to Breadboard negative pin (blue line)
  5. Connect button first pin to breadboard positive pin (red line)
  6. Connect button second pin to arduino digital pin 7
  7. Connect button second pin to resistor
  8. Connect resistor to breadboard negative pin (blue line)

Step 3: Start Visuino, and Select the Arduino UNO Board Type

To start programming the Arduino, you will need to have the Arduino IDE installed from here:

Please be aware that there are some critical bugs in Arduino IDE 1.6.6. Make sure that you install 1.6.7 or higher, otherwise this Instructable will not work! If you have not done follow the steps in this Instructable to setup the Arduino IDE to program Arduino UNO! The Visuino: also needs to be installed. Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

Step 4: In Visuino Add Components and Connect Them

  1. Add "Detect Edge" component
  2. Add "(T) Flip-Flop" component
  3. Connect Arduino Digital Out pin [7] to "DetectEdge1" component pin[In]
  4. Connect "DetectEdge1" component pin[Out] to "TFlipFlop1" component pin[Clock]
  5. Connect "TFlipFlop1" component pin[Out] to Arduino Digital IN pin[13]

Step 5: Generate, Compile, and Upload the Arduino Code

In Visuino, Press F9 or click on the button shown on Picture 1 to generate the Arduino code, and open the Arduino IDE

In the Arduino IDE, click on the Upload button, to compile and upload the code (Picture 2)

Step 6: Play

If you power the Arduino UNO module, you will be able to turn the LED ON or OFF by pressing a button.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it here.
You can download and open it in Visuino: