In this section a simple use of the programming an arduino uno is depicted
The idea is to flash the built in LED in the arduino with a bush button in a way that the LED flashes 4 times with a regression in delay
inversly proportional to the times the push button is clicked
What do we need
1- Arduino Uno
2- Arduino data cable
3- Push button
4- Bread board
5- Resistor for protecting the components
6- Connecting cables (male-male, female-male)
7- computer equipped with the Arduino software
Getting to work : Connections
First We connect the components on the bread board in this following way, I am using here the software Tinkercad for better visualisation
and making sure that the program is running accordingly
The connection is done color coded as follows:
- RED: Positive connected to power pin 5V of the arduino
- BLACK: Ground or negative side of the circuit connected to the GND pin on the arduino
- ORANGE: Data connected to pin 6 on the digital pins of the arduino
The connection should look as depicted
Arduino setup
Then we run the arduino program an connect the arduino data USB cable
Setting up of the arduino is done using the Tool >> boards >> Arduino UNO
LED code
The idea is based on clicking the push button to flash the built in LED on the arduino but with a decaying delay inversly proportional to the
number of clicks on the push button
The code is depicted in the following pictures
Testing
after finializing the code I first tested it on the Tinkercad software to make sure that it's working flowlessly
Then we validated and upload the code on the Arduino and by testing it it should behave as following