Introduction

The Arduino microcontroller is used for rapid prototyping. It can receive data from sensors to collect information in its surroundings and it can be used to control other electronic components like lights, motors and more.

How it works

A program is written in the Arduino Integrated Development Environment (IDE), a special program that runs on your computer to allow you to write programs for the Arduino board in a simple language based on the language Wiring. When you press the button that uploads the program to your board, the code you have written is translated into the C language, and is passed on to the avr-gcc compiler, a piece of open-source software that makes the ultimate translation into the language understood by the microcontroller. This last step is important—it's where the Arduino IDE makes your life simpler by hiding away as much as possible the complexities of programming a microcontroller.

The Interface

interface



Click Verify to check your code
error



Help
Hilight a word then click on Help>Reference to see an explanation
help



Common functions

  • pinMode()—set a pin as input or output

  • digitalWrite()—set a digital pin high/low

  • digitalRead()—read a digital pin's state

  • analogRead()—read an analog pin

  • analogWrite()—write an "analog" value

  • delay()—wait an amount of time

  • millis()—get the current time


For more information see the Arduino Programming Notebook



The Basic Sketch Structure

  • Declare your variables at top of your sketch

  • Initialize values
    • setup()— run once at beginning, set pins
  • Running
    • loop()— run repeatedly, after setup()