Digital Inputs and Outputs
- The basic Arduino board has 14 digital pins that can be used either as inputs or outputs
- Digital inputs are used to read buttons/switches and other digital signals
- Digital outputs are used to control other electric components or devices (LEDs, motors etc.)
- You set the pin as INPUT or OUTPUT with the pinMode() function
The basic Arduino board does not have real analog output, but some of the pins support PWM (pulse-width modulation). PWM lets us to “fake” an analog signal with digital outputs. It can be used to fade lights, control the speed of motors etc.
The Arduino Duemilanove/UNO/Leonardo boards have 6 analog inputs. They are 10-bit ADCs (analog-to-digital converters). The analog inputs are used to read analog sensors.
Logic Level and the Resolution of Inputs and Outputs.
|digitalRead()||LOW (0)||HIGH (1)|
|digitalWrite()||LOW (0)||HIGH (1)|
The Arduino uses a serial port to send/receive data between the board and the computer (or any other device that supports serial communication).