It was first week of quarantine and I felt really overwhelmed and unmotivated by everything that happened. Somehow I tried to put myself together and work on something. Idea of this week is to learn more theory and to program our own board. I don’t have much of experience of programming with Arduino, but I found it really interesting to learn it.
during quarantine, I had at my disposal an arduino uno kit (half of which was successfully used in “almost useful machines” and then evaporated in the IAAC space, which is completely my fall). So here is my mess Half Arduino Kit and GTO:
Arduino is the largest open-source hardware platform in the world that provides unlimited possibilities that can be achieved using microcontroller-based products. Therefore, Arduino starter kit is a perfect way to dive into electronics and programming as you get all the essential components in a single package which is required to start working with Arduino. So, with all the opportunities I have with Arduino I decided to keep it simple at first and experiment with leds.
Datasheet
If youre programming board, it is important to understand how it works internally. A datasheet is a document summarizing the performance and other technical characteristics of a product, machine, component, material. In Datasheet you can find explanation of the components and how to use it. For my Arduino Uno I had to search for datasheet of ATmega328.
I can’t say that I understood everything in a datasheet. There’s a lot of information that might not be of any use to me. So, I’ll try to point out parts of the datasheet that you should pay particular attention to.
ATmega-328 is basically an Advanced Virtual RISC (AVR) micro-controller. It have several different features which make it the most popular device in today's market. These features consist of advanced RISC architecture, good performance, low power consumption, real timer counter having separate oscillator, 6 PWM pins, programmable Serial USART, programming lock for software security, throughput up to 20 MIPS etc.
ATmega328 is an 8-bit and 28 Pins AVR Microcontroller, manufactured by Microchip, follows RISC Architecure and has a flash type program memory of 32KB. It has an EEPROM memory of 1KB and its SRAM memory is of 2KB.
It has 8 Pin for ADC operations, which all combines to form PortA ( PA0 - PA7 ).
It operates ranging from 3.3V to 5.5V but normally we use 5V as a standard.
It also has 3 builtin Timers, two of them are 8 Bit timers while the third one is 16-Bit Timer.
It operates ranging from 3.3V to 5.5V but normally we use 5V as a standard.
Its excellent features include the cost efficiency, low power dissipation, programming lock for security purposes, real timer counter with separate oscillator.
It's normally used in Embedded Systems applications. You should have a look at these Real Life Examples of Embedded Systems, we can design all of them using this Microcontroller.
Blinking the LED
With a simple modification of the breadboard, we could attach the LED to an output pin of the Arduino. Move the red jumper wire from the Arduino 5V connector to D13, as shown below:
Now load the 'Blink' example sketch. You will notice that both the built-in 'L' LED and the external LED should now blink.
We going to look at a better way to program an Arduino using platform IO. This allows you to use vs code to program your Arduino without anything in-between.
First we need to install visual code
After we installed it we need to install extension “Platformio”
After installation is complete we will be prompted to reload vs code. After reload we can start new project. We need to select the board we are using, in my case it is Arduino uno
Once the project is initialized you will be given a directory to work in. The only folder we’re really think about right now is SRC and “main.cpp”. This is your file that will go on to the Arduino and the cpp extension is because this is C++
Let’s start with blink project. We are going to define the pin as onboard 13 that’s the onboard led on my Arduino. And then in our setup function we’re going to set things up as normal.
No one thing I noticed straight away is that we have completion. I don’t have in mode out it knows that I might be wanting that and I just press ENTER in order to autofill it. We also have some suggestions about what we should be putting in this
That is our code done. Save your sketch and lets get ready to put it up on our board. Now you will notice on your bottom toolbar Visual Studio code some new buttons. We are gonna click this tick which is the build button(which is the same as the compile button in the Arduino IDE). If it builds without any problem we can click the arrow button in order to upload it to the board.
Now, when we have simple blinking code, we can try to modify it. I will make an SOS blinking led.
Let’s try something else
After this simple testing I’m becoming very interested in the possibilities simple boards can offer. I start from a very low level of knowledge so felt happy of making some basic blink, but I will surely explore more during the input and output devices week. This has been a good way to get familiar with Arduino IDE and understand the basic rules of its coding language, after observing the logics behind the already made codes I used. You can experiment with this really long, it very interesting. My personal opinion after working in Visual Studio code is that its great alternative to Arduino. It’s make some process much more convenient and simple.
Here are some links for tutorials that can help you
https://www.youtube.com/watch?v=e1FVSpkw6q4 https://www.instructables.com/id/Arduino-Controlling-the-Onboard-LED-Part-3/ https://www.programmingelectronics.com/tutorial-17-using-a-button-old-version/Files
Arduino Blink Code/Copyrights © 2019. Designed & Developed by Themefisher