Reference   Language (extended) | Libraries | Comparison | Board

Libraries

To use an existing library in a sketch, go to the Sketch menu, choose "Import Library", and pick from the libraries available. This will insert one or more #include statements at the top of the sketch and allow it to use the library.

Because libraries are uploaded to the board with your sketch, they increase the amount of space it takes up. If a sketch no longer needs a library, simply delete its #include statements from the top of your code.

Official Libraries

These are the "official" libraries that are included in the Arduino distribution.

  • EEPROM - reading and writing to "permanent" storage
  • Ethernet - for connecting to the internet (using the Arduino Ethernet shield)
  • LiquidCrystal - for controlling liquid crystal displays (LCDs)
  • Servo - for controlling servo motors
  • SoftwareSerial - for serial communication on any digital pins
  • Stepper - for controlling stepper motors
  • Wire - Two Wire Interface (TWI/I2C) for sending and receiving data over a net of devices or sensors.

These libraries are compatible Wiring versions, and the links below point to the (excellent) Wiring documentation.

  • Matrix - Basic LED Matrix display manipulation library
  • Sprite - Basic image sprite manipulation library for use in animations with an LED matrix

Contributed Libraries

Libraries written by members of the Arduino community.

  • DateTime - a library for keeping track of the current date and time in software.
  • Firmata - for communicating with applications on the computer using a standard serial protocol.
  • GLCD - graphics routines for LCD based on the KS0108 or equivalent chipset.
  • LCD - control LCDs (using 8 data lines)
  • LCD 4 Bit - control LCDs (using 4 data lines)
  • LedControl - for controlling LED matrices or seven-segment displays with a MAX7221 or MAX7219.
  • LedControl - an alternative to the Matrix library for driving multiple LEDs with Maxim chips.
  • TextString - handle strings
  • Metro - help you time actions at regular intervals
  • MsTimer2 - uses the timer 2 interrupt to trigger an action every N milliseconds.
  • OneWire - control devices (from Dallas Semiconductor) that use the One Wire protocol.
  • PS2Keyboard - read characters from a PS2 keyboard.
  • Servo - provides software support for Servo motors on any pins.
  • Servotimer1 - provides hardware support for Servo motors on pins 9 and 10
  • Simple Message System - send messages between Arduino and the computer
  • SSerial2Mobile - send text messages or emails using a cell phone (via AT commands over software serial)
  • TLC5940 - 16 channel 12 bit PWM controller.
  • X10 - Sending X10 signals over AC power lines

To install, unzip the library to a sub-directory of the hardware/libraries sub-directory of the Arduino application directory. Then launch the Arduino environment; you should see the library in the Import Library menu.

For a guide to writing your own libraries, see this tutorial.

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.