Arduino Uno Programming for Beginners Part 2
Well, you can’t access the world wide web without having a connecting medium, can you?. It is equally true that you can’t enjoy the benefits of the Arduino Uno board without knowing how to program the Arduino development board.
Arduino hardware and software work hand-in-hand. As the hardware allows you to connect other peripherals (sensors and other components) so that it can interact with the outside world, the software directs the hardware with a series of instructions and dynamic routines.
This part is about a brief introduction to the programming language, IDE and also installing the necessary software and drivers.
This tutorial is part of a series “Arduino Uno Programming for Beginners”. To get started you may need to read the first part here (overview of the Arduino hardware).
It is practically impossible to socialize with someone who doesn’t understand your language and enjoy it fully. For this reason, talking, texting and of course, sign languages are all part of enjoyable socialization.
Computers and other embedded systems do talk and oh yes! in their own language (binary codes). But I must confess that there is a vast difference between a computer and human languages in terms of their flexibility. Humans are able to comprehend language with grammatical errors, mixed dialogue, and broken phrases.
Unlike humans, machine languages are very strict and sensitive. To talk to machines, you have to follow a set of rules and procedures (which can be analogized to grammatical rules) in a form of instructions. These instructions are what we called the programming language.
To code (communicate and control machines), one needs to learn a programming language.wikipedia.org
What is a Programming Language?
A programming language is a set of grammatical rules, commands, instructions, and other syntax use to create a software program and also for instructing a computer or computing device to perform specific tasks.
There are two main types of programming language namely: High level and Low
A high-level language (HLL) is a programming language that enables a programmer to write programs that are more or less independent of a particular type of computer. Such languages are considered high-level because they are closer to human languages and mathematical notation.
Examples include Assembly Language, Machine Code.
The diagram above illustrates how high and low-level programming language is done. You will bear with me that low-level programming languages are very difficult to learn. It is, therefore, NOT surprising to see most (if not all) developers are only conversant with high-level programming languages.
The diagram below shows some of the common Programming Languages available
Arduino Uno Programming: IDE and Text Editors
IDE stands for “integrated development environment”. they contain compilers that change the high-level programming language to machine codes. They also come with a text editor for writing the codes.
Common IDE’s are Arduino IDE (Eclipse), MPLAB, Visual Studio, Android Studio. Choosing an IDE depends on the type of programming language you want to use. Since we are learning Arduino, we will be using the Arduino IDE.
The Arduino IDE is installed the same way most windows applications are done. They are free to download and open source so there is no need
Now that you have installed the IDE, let’s see what the Arduino language is and the syntaxes we can use to create amazing projects.
The Arduino Programming Language Reference
Just like we can identify parts of speech in the English language (noun, verb, adjective, etc.), the Arduino programming language can also be divided into three main parts. These are Structure, Values (variables and constants), and Functions.
Arduino Uno Programming: Structure
The Arduino Structure is the elements of Arduino (C++) code. This constitutes the syntax used in C++ programming language. A structure must be specified exactly as used in the C++ library. The structure, therefore, defines the specific rules that must be followed to get the rest of the code working.
Values (variables and constants)
Arduino data types and constants. These are the types of values and constants that can be processed by the Arduino. To understand Arduino variables and constants, we need to analogize the phenomena with the file format. For example, the VLC media player is specifically designed to play media file formats (such as mp3, mp4, Avi, etc.).
There is no way a vlc program will play an office file formats (such as .doc, docx, pdf, etc.). As u can see, the type of file format associated with the Arduino language is the values. A value that can be changed/altered when the Arduino is executing the instructions is “Variable” and those that are fixed and cannot be altered during the program execution are “constants”.
Arduino Uno Programming: Functions.
The function is used for controlling the Arduino board and also for performing computations. We will use a function to turn a pin ON or OFF or to set a pin to OUTPUT current or as INPUT to receive an incoming signal.
The three (parts) of the Arduino language are listed above. As you can see, they have been colored to distinguish from each other. The Arduino IDE uses the same colors to tell you the part in which a piece of code belongs.
A code with orange color is a function, a bluecolored code is a value (variable or constant) and a code with green color is a structure.
At, we learn by doing. Therefore I will explain in electrotekgh details thefunctions, variables andstructure by doing mini projects with them.
I hope by now, you have geared up for a higher level. Of course, we have a very huge mountain of projects to climb but until then, relax and have a stressfree day. farewell!.
Together we can!