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
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 (or any other Arduino)
- Jumper wires
- Button
- LED
- Resistor 1k ohm (or something similar)
- Breadboard
- Visuino program: Download Visuino
The Circuit
- Connect Arduino Pin 5V to breadboard positive pin (red line)
- Connect Arduino Pin GND to breadboard negative pin (blue line)
- Connect Arduino Digital pin 13 to LED positive pin
- Connect LED negative pin to Breadboard negative pin (blue line)
- Connect button first pin to breadboard positive pin (red line)
- Connect button second pin to arduino digital pin 7
- Connect button second pin to resistor
- Connect resistor to breadboard negative pin (blue line)
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: 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
- Add "Detect Edge" component
- Add "(T) Flip-Flop" component
- Connect Arduino Digital Out pin [7] to "DetectEdge1" component pin[In]
- Connect "DetectEdge1" component pin[Out] to "TFlipFlop1" component pin[Clock]
- Connect "TFlipFlop1" component pin[Out] to Arduino Digital IN pin[13]
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)
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