9
Arduino Software handson.dmt.fh-joanneum.at © Carelse, Pauger, Pilz 1 A RDUINO Worksheet: Arduino Software Description: In this worksheet we’ll setup the Arduino Software (IDE) and upload our first sketch to the Arduino Uno and learn the basics of using the Serial Monitor. Difficulty (1-10): 1 Overview: Getting Started User Interface Basics Initial Setup Opening the Blink sketch Uploading the Blink sketch Serial Monitor Basics Troubleshooting Useful Resources Requirements: Hardware: Arduino Board (Uno) Connection Cable Software: Arduino Software (IDE)

Arduino Software (IDE)

Embed Size (px)

DESCRIPTION

n this worksheet we’ll setup the Arduino Software (IDE) and upload our first sketch to the Arduino Uno and learn the basics of using the Serial Monitor

Citation preview

Page 1: Arduino Software (IDE)

Arduino Software handson.dmt.fh-joanneum.at

© Carelse, Pauger, Pilz 1

ARDUINO Worksheet: Arduino Software Description: In this worksheet we’ll setup the Arduino Software (IDE) and upload

our first sketch to the Arduino Uno and learn the basics of using the Serial Monitor.

Difficulty (1-10): 1 Overview: Getting Started

User Interface Basics Initial Setup Opening the Blink sketch Uploading the Blink sketch Serial Monitor Basics Troubleshooting Useful Resources

Requirements: Hardware: Arduino Board (Uno) Connection Cable

Software: Arduino Software (IDE)

Page 2: Arduino Software (IDE)

Arduino Software handson.dmt.fh-joanneum.at

© Carelse, Pauger, Pilz 2

DIGITAL IOS To enable the Arduino boards to do a variety of cool things, we need to be able to communicate with it. To do this, we'll need a development environment also known as an IDE to write code and upload it to the Arduino board. Fortunately, Arduino comes with its own development environment that’s freely available and easy to use. In this worksheet we’ll guide you through the process of downloading and installing the Arduino Software and then uploading your first programme onto your Arduino Uno board.

Instructions 1. Getting Started

• Search in Google for “Arduino Software”.

• Click on the Arduino-Software link.

• The latest release at time of writing is Arduino 1.0.5.

• Choose your operating system.

• Download and install. • In this example the mac OS X version will be used.

• The package is about 80mb(zip) and 200mb(unzipped) and will take less than a

minute to download.

• Go to your download location and simply copy the package into your application folder to install

• As usual when running applications downloaded from the web for the first time, you’ll receive the following confirmation window:

• Click “Open” to open the Arduino IDE

Page 3: Arduino Software (IDE)

Arduino Software handson.dmt.fh-joanneum.at

© Carelse, Pauger, Pilz 3

2. User Interface Basics In this section we’ll familiarize ourselves with the Arduino IDE interface.

Now, that we’ve got an overview of the Arduino’s user interface. Let’s get ready to load our first sketch onto our Arduino Uno.

Verify Checks your code

for errors.

Upload Compiles your

code and uploads it to the Arduino

board. .

New Creates a new

sketch.

Open Existing Displays a menu

list of existing sketches as well as pre-installed

Arduino sketches to help you get

started.

Save Saves your

sketch.

New Tab Allows you to

manage sketches with more than one

file.

Text Console Displays status

and error messages.

Sketch Area Area for writing

your scripts.

Serial Monitor Opens the Serial

Monitor. The serial

monitor can be used to view the

data being transfered

between your computer and

Arduino. Useful for testing

sensors and essential for debugging!

Page 4: Arduino Software (IDE)

Arduino Software handson.dmt.fh-joanneum.at

© Carelse, Pauger, Pilz 4

3. Initial Setup To setup the communication port from the Arduino IDE to the Arduino board, we have to choose the board from the menu list. In our case it’s an Arduino UNO.

• Click on ”Tools”

• Then “Boards” -> “Arduino Uno”

4. Opening the Blink Sketch Once you’ve selected the right Arduino board. We’re ready to upload our first sketch. What “hello world” is to the programming world, “Blink” is to the microcontroller world. The Blink sketch will provide us with a basic overview to introduce us to the structure of an Arduino sketch.

Page 5: Arduino Software (IDE)

Arduino Software handson.dmt.fh-joanneum.at

© Carelse, Pauger, Pilz 5

Here we see a screenshot of what you can expect to see when opening the sketch.

5. Uploading the Sketch Once you’ve opened the Blink sketch and gained an understanding of the sketch structure, you ready to upload it to the Arduino board. If you haven’t connected your Arduino board yet, now is a good time to do so.

The setup() function is called when a sketch

starts. Use it to initialize variables, pin

modes, start using libraries, etc. The

setup function will only run once, after each powerup or reset of the Arduino board.

The loop() function loops consecutively,

allowing your program to change

and respond as it runs. Code in the loop() section of

your sketch is used to actively control

the Arduino board.

When a line starts with two slashes “ // ” it

indicates a comment and will not be

compiled by the compiler. Useful for

inserting helpful comments describing your code and what it

does.

Page 6: Arduino Software (IDE)

Arduino Software handson.dmt.fh-joanneum.at

© Carelse, Pauger, Pilz 6

Once connected, select the serial device by going to Tools > Serial Port and selecting /dev/tty.usbmodem

Next, simply click on the upload button.

If the upload was successful you’ll receive a confirmation in the console area that uploading is done!

If all went well, you should then see an orange LED blinking close to pin 13.

Congratulations! You managed to upload your first sketch using the Arduino IDE!

Page 7: Arduino Software (IDE)

Arduino Software handson.dmt.fh-joanneum.at

© Carelse, Pauger, Pilz 7

Serial Monitor Basics Understanding how to use the Serial Monitor is essential for creating interactive projects using Arduino. The serial monitor will enable you to send and receive data between your computer and Arduino. Ideal for receiving data from sensors and controlling motors attached to your Arduino using your computer. In the following example we’ll learn how to send and receive data using the serial monitor. You could simply load the “Simple Serial ECHO script” (found in the download package) or code the snippet below into the Arduino IDE.

Once the sketch is loaded or coded, 1) Verify and 2) Upload the sketch to the Arduino.

1

2

Page 8: Arduino Software (IDE)

Arduino Software handson.dmt.fh-joanneum.at

© Carelse, Pauger, Pilz 8

After uploading the sketch successfully click on the Serial Monitor button to launch the serial monitor window.

A window similar to the one below should open up. Type in some text of your choice and click send. The serial monitor then sends the data to the Arduino with the Arduino “echoing” it back to the serial monitor.

If you would like to continue the example above, please click on the following link where you will learn how to integrate the Arduino IDE and the Processing IDE: http://arduinobasics.blogspot.com.au/2012/07/arduino-basics-simple-arduino-serial.html

Trouble Shooting Incase the Arduino Software loads in another language, go to the preferences menu and choose your language of choice from the drop down menu.

Page 9: Arduino Software (IDE)

Arduino Software handson.dmt.fh-joanneum.at

© Carelse, Pauger, Pilz 9

You sketchbook folder can also be changed to a more preferred location

Useful Resources

• Ladyada – Using the Serial Library http://www.ladyada.net/learn/arduino/lesson4.html

• Arduino Basics – Simple Arduino Serial Basics

http://arduinobasics.blogspot.co.at/search/label/Serial%20Monitor

• Arduino Development Tools http://playground.arduino.cc/Main/DevelopmentTools

• Arduino Basics Blog – Simple Arduino Serial Communication

http://arduinobasics.blogspot.com.au/2012/07/arduino-basics-simple-arduino-serial.html

• Processing Language (IDE)

http://processing.org