2
Getting Started
Having introduced the Arduino, and learnt a little about what it is
that we are programming, it is time to learn how install the software
that we will need on our computer and to start working on some
code.
One of the board's digital input output ports is connected to the
LED labelled L. The device is attached to digital pin 13. This
restricts the use of pin 13 to an output. You can still attach other
devices to that socket, though, because the LED only consumes a
modest amount of current.
The hello world program is shown in
different languages for traditional first program You now need to
transfer or upload that sketch to your Arduino board. So plug your
Arduino board into your computer using the USB lead. You should
see the green “On” LED on the Arduino light up. The Arduino board
will probably already be flashing, as the boards are generally
shipped with the Blink sketch already installed. But let’s install it
again and then modify it.
When you plug the board in, if you are using a Mac, you may get
the message, “A new network interface has been detected.” Just
click Cancel; your Mac is confused and thinks that the Uno is a
USB modem.
If you click on the upload button if worked fine then the led will blink
twice as fast as the first time Congratulations, you are now ready to
start programming your Arduino. First, though, let’s take a mini-tour
of the Arduino application.
Arduino sketches resemble word processing documents. You can
open them up and copy sections between them. As a result, the
File menu includes options for Open, Save, and Save As. Since the
Arduino programme has the idea of a Sketchbook, where all of your
drawings are meticulously organised into folders, you won't typically
use Open. The File menu provides access to the Sketchbook.
Since you just installed the Arduino application, your Sketchbook
won't have any sketches until you add any.
As you can see, there are several example sketches included with
the Arduino application that are quite helpful. If you try to save the
Blink example drawing after making changes, it won't save.
Conclusion
Chapter 3
The language that is used for programming is the C programming language on
Arduino.
digitalWrite(13, HIGH) ;
delay(500) ;
digitalWrite(13, LOW) ;
These three lines would each do something. The first line would set the output of
pin 13 to HIGH. This is the pin with an LED built in to the Arduino board, so at this
point the LED would light. The second line would simply wait for 500 milliseconds
(half a second) and then the third line would turn the LED back off again. So these
three lines would achieve the goal of making the LED blink once. Let's start by
talking about the punctuation and word formation. Both of these fall under the
umbrella of the language's syntax. One of the basic requirements in most
languages is that names for things must only be one word, thus you have to be
very precise with your syntax. They are so unable to contain spaces. DigitalWrite
thus refers to something. It is the name of a built-in function that will set an
output pin on the Arduino board (you will learn more about functions later).
Names must not only have no spaces, but they must also match exactly. As a
result, digitalWrite must be used instead of DigitalWrite or Digitalwrite.