Book Image

Arduino Robotic Projects

By : Richard Grimmett
Book Image

Arduino Robotic Projects

By: Richard Grimmett

Overview of this book

Table of Contents (21 chapters)
Arduino Robotic Projects
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The Arduino IDE and LED code


To create the LED code, start the Arduino IDE. Then, recall the code you wrote in Chapter 1, Powering on Arduino. The IDE should look like the following screenshot:

In this code, setting led 13 lit the orange LED on the board. It turns out that the led output pin 13 is also the connection to pin 13 on the connector of the Arduino Uno. If you upload and run this program, the LED connected to pin 13 should flash at the same rate as the LED on the Arduino Uno, as shown in the following image:

You'll need to add a similar bit of code to get the LEDs connected to pins 12 and 11. Add the code snippet that can be seen in the following screenshot to the sketch on the Arduino IDE:

Here, you are replicating the code for the led connected to pin 13 to the second led1 connected to pin 12 and the third led2 connected to pin 13. You then program them all to be output pins, and then in the main loop, toggle between high and low. Note that I have two toggling together (pins 13...