Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Arduino By Example

You're reading from  Arduino By Example

Product type Book
Published in Sep 2015
Publisher
ISBN-13 9781785289088
Pages 242 pages
Edition 1st Edition
Languages
Authors (2):
 Adith Jagadish Boloor Adith Jagadish Boloor
Profile icon Adith Jagadish Boloor
Adith Jagdish Boloor Adith Jagdish Boloor
Profile icon Adith Jagdish Boloor
View More author details
Toc

Hello World


The easiest way to start working with Arduinos begins here. You'll learn how to output print statements. The Arduino uses a Serial Monitor for displaying information such as print statements, sensor data, and the like. This is a very powerful tool for debugging long codes. Now for your first code!

Writing a simple print statement

Open up the Arduino IDE and copy the following code into a new sketch:

void setup() {
Serial.begin(9600);
Serial.println("Hello World!");
}

void loop() {
}

Open Tools | Board and choose Arduino UNO, as shown in the following screenshot:

Open Tools | Port and choose the appropriate port (remember the previous COM xx number? select that), as shown in the following screenshot. For Mac and Linux users, once you have connected the Arduino board, going to Tools | Serial Port will give you a list of ports. The Arduino is typically something like /dev/tty.usbmodem12345 where 12345 will be different.

Selecting the Port

Finally, hit the Upload button. If everything is fine, the LEDs on the Arduino should start flickering as the code is uploaded to the Arduino. The code will then have uploaded to the Arduino.

To see what you have accomplished, click on the Serial Monitor button on the right side and switch the baud rate on the Serial Monitor window to 9600.

You should see your message Hello World! waiting for you there.

You have been reading a chapter from
Arduino By Example
Published in: Sep 2015 Publisher: ISBN-13: 9781785289088
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}