From ArduinoInfo
Jump to navigation Jump to search


Physical Computing is quite different than writing software for personal computers where the only physical inputs are the Mouse and Keyboard. With Arduino you can connect and control literally hundreds of different devices, and write software that creates new Intelligent Devices. We can see how this goes together here:
SENSOR INPUTS: On the left are examples of some of the Input Devices you can connect.
ACTION OUTPUTS: On the right are examples of Output Devices you can control.
SOFTWARE BEHAVIOR: Here is where you write software (called SKETCHES in Arduino) that makes decisions about what things are sensed with Input Devices, and what actions will be taken with the Output Devices. This may be as simple as sounding a buzzer when a switch is closed.

The Arduino IDE (Integrated Development Environment)

This is the free software you will use to create the Behavior of your project. Here's what it includes:
  • An EDITOR to create and edit the text of your software Sketch. It actively highlights Keywords in the language so typing errors are more obvious.
  • A VERIFY system that runs through your Sketch, verifies that there are no errors, and then compiles it into the machine language program that can be Uploaded to your Arduino board over the USB cable. (This is often called MAKE in other systems, and actually is quite complex, running system preprocessor, compiler, linker etc. "Under the covers").
  • An UPLOAD system that communicates with your Arduino Board over USB, loads your program into Arduino memory, and starts your program running.
  • A SERIAL MONITOR window that allows you to receive and send messages from programs running on your Arduino board. This is often used for testing and "debugging" programs.
  • Many EXAMPLE software Sketches that show how to use many different devices and techniques.
  • A LIBRARY system containing many prewritten sections of software.
  • A FILE system to save and retrieve Sketches.
  • A HELP system that includes the entire Arduino Reference document.

Arduino IDE Screen:


On the left is an example of the Arduino IDE window:

  • The example text is from a Sketch controlling 4 relays which control higher power devices like room lights, motors etc.
  • The top menu has File, Edit etc.
  • The Button Menu has Verify (check mark), Upload (right arrow) etc.
  • At the bottom you see the Verify result and how much of your Arduino memory was needed. This lower window also displays error messages.

More details of using the IDE are in another section of the ARduinoInfo.Info WIKI.

The "Arduino Language":

If you haven't written "code" in any computer language yet, you'll have to get used to writing very specific commands to get things done. But Arduino gives you many easy to use commands. Many people can help you with Arduino. SEE [help from Nick Gammon]

To turn an LED ON for example, you'd write something like:

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) and to turn it off again, you'd write:

digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
Now look closely at those lines:

  • The Gray sections on the right (after "//") are only COMMENTS to tell the reader what the programmer intended, or explain things. They are ignored by Arduino
  • The command ("digitalWrite") is highlighted. If you misspelled it, it would just be black.
  • There are special words you'll need to learn like HIGH and LOW.
  • Each command ends with a SemiColon character. This is required to show the end of a command.

Verify is Fussy, Fussy! If you misspell something, forget the ";", or use unknown words, it will put out Error messages and try to tell you which line is the problem.

Lots more about using the IDE and writing software Sketches on other pages of this WIKI.

Arduino Libraries:

When you start writing Arduino software Sketches, you are not in a room alone. You are in a Library, with many pre-written examples that make it easy to use more complex functions like connecting to the Internet. Here are the Standard Libraries that come with the free IDE software install:

  • EEPROM - reading and writing to "permanent" storage
  • Ethernet - for connecting to the internet using the Arduino Ethernet Shield
  • Firmata - for communicating with applications on the computer using a standard serial protocol.
  • LiquidCrystal - for controlling liquid crystal displays (LCDs)
  • SD - for reading and writing SD cards
  • Servo - for controlling servo motors
  • SPI - for communicating with devices using the Serial Peripheral Interface (SPI) Bus
  • SoftwareSerial - for serial communication on any digital pins. Version 1.0 and later of Arduino incorporate Mikal Hart's NewSoftSerial library as SoftwareSerial.
  • Stepper - for controlling stepper motors
  • WiFi - for connecting to the internet using the Arduino WiFi shield
  • Wire - Two Wire Interface (TWI/I2C) for sending and receiving data over a net of devices or sensors

One of the greatest advantages of Arduino is the worldwide community of thousands of people who are using it. Arduino enthusiasts who have figured out how to do more complex things have shared their work by creating Contributed Libraries. Some of the categories of libraries are:

  • Communication (networking and protocols):
  • Sensing:
  • Displays and LEDs:
  • Audio and Waveforms:
  • Motors and PWM:
  • Timing:
  • Utilities:

See the details on the Arduino site here: And when you figure out something cool that other people could use, see the Tutorial on that page about writing your own libraries.

To Be Done: Kicker with a few example projects, kids doing stuff...


From Scott:

If you are new to the world of microcontrollers, the Arduino is the best place to start. Since it is the most popular platform, the community at large is really active. That makes support easy to get and finding the information you need is even easier. Add to that great support is the large eco-system surrounding it, and you just can’t go wrong with the Arduino.