Date: 24/10/2017
TITLE: Learn about arduino and C language
TITLE: Learn about arduino and C language
In this week I’m continuing
my research about C programming language to use in Arduino UNO. This time the
research is going into learn about basic introduction in C language, flow
control, function, array and structure & file. In programming, functions
and flow control is very important to write the code. I also need to take a long time to study this
part. As mentioned, it’s a good language to start learning
programming. If you know C programming, you will not just understand how your
program works, but you will also be able to create a mental picture on how a
computer works. Programming is a very fun and interesting to learn!
Download Arduino Software
Firstly, you need to download the Arduino Software package for your operating system from the Arduino download page.
When you’ve downloaded and opened the application you should see something like this:
Arduino Software
This is where you type the code you want to compile and send to the Arduino board.
The Initial Setup
We need to setup the environment to Tools menu and select Board.
Then select the type of Arduino you want to program, in our case it’s the Arduino Uno.
The Code
The code you write for your Arduino are known as sketches. They are written in C++.
Every sketch needs two void type functions,
setup()
and loop()
. A void type function doesn’t return any value.
The
setup()
method is ran once at the just after the Arduino is powered up and the loop()
method is ran continuously afterwards. The setup()
is where you want to do any initialisation steps, and in loop()
you want to run the code you want to run over and over again.
So, your basic sketch or program should look like this:
|
|
Now we have the basic skeleton in place we can now do the Hello, World program of microcontrollers, a blinking an LED.
Press Upload and you should see LED in port 13 will blinking in every 2 seconds
|
|
No comments:
Post a Comment