week 8
- embedded programming
- Assignment: program your board to do something
Electronics learning continues with the analysis of the microprocessor and its parts in order to understand how it is made and works and finally programming.
Basically it is a small computer where you can add peripherals and program it to do one job.
Arduino is a microprocessor very versatile, with digital and analogs ports that make it expandible.
Each of the ports is made of 8 pins which can be inputs or outputs. Analogs one are only inputs, only reading, and the pwm digital pins can act as analgs but are also able to analog write.
All other digital pins have both programmable directions.
Programming languages are many but at the moment I'll go through Arduino's coding and a visual programming software: illumination software creator.
For this week assignement i decided to execute a basic blinking with an interaction between button and led from Arduino's.
First thing get a datasheet of the cpu, in order to identify the pins and proceed.
The procedure in the IDE is to identify the ISP programmer in the tools list an then the Arduino's type cpu. Execute the Bootloader so the board is programmable.
In the code's architecture, first it is to find on the datasheet the pins where led and button are connected.
Then it is to declare variables and constants in the setup, which remanis for all the program execution. Then we set the loop, which apply the variables and the costants in a defined time with a start and an end.
My idea is to set a random blinking and if the button is pushed while led is high, then the led stays high.
To do this I have to use booleans variables for setting true or false conditions.
I found a lot of libraries on the web that helped me to success. When random blinking, if it is not so fast, it is possible to catch the "HIGH" and stop it.