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

by RonFrtek in Circuits > Arduino

4233 Views, 3 Favorites, 0 Comments

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

Visuino: How to use a button as an Input to Control things like LED

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

Watch a demonstration video.

What You Will Need

arduino-uno.jpg
F8KZFL7K1UXJL1S.LARGE.jpg
buttons2.jpg
RED_5mm_LED__98425.1414619361.1280.1280.jpg
311bGhoaiPL._SX342_.jpg
Half-Sized_Breadboard_-_Oblique_-_600__61198.1507056554.1280.1280.png
VisuinoAdvrtisementM5Stack5.jpg
  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

The Circuit

2019-11-27_14-08-11.jpg

  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)

Start Visuino, and Select the Arduino UNO Board Type

F294BW3JFX0MSX9.LARGE.jpg
FHSXK6PJFX0MSQH.LARGE.jpg

To start programming the Arduino, you will need to have the Arduino IDE installed from here: https://www.arduino.cc/.

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: https://www.visuino.eu 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

In Visuino Add Components and Connect Them

2019-11-27_13-38-11.jpg

  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]

Generate, Compile, and Upload the Arduino Code

FAAEWOFJOWSMLZS.LARGE.jpg
FDQU641JLMKOKCS.LARGE.jpg

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)

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: https://www.visuino.eu