Reader small image

You're reading from  Arduino Development Cookbook

Product typeBook
Published inApr 2015
Publisher
ISBN-139781783982943
Edition1st Edition
Tools
Concepts
Right arrow
Author (1)
Cornel M Amariei
Cornel M Amariei
author image
Cornel M Amariei

Cornel Amariei is a Romanian inventor and entrepreneur in the fields of Robotics and 3D printing. He has been working with the Arduino platform since its early days in 2007. His past experience involves large cargo gamma ray scanning robotics, ATM security systems, and blind assisting devices. In his spare time, he is a performing musician playing multiple instruments—predominately the guitar. He is also a swimmer, water polo player, and photographer. Over the years, he has built hundreds of Arduino projects, ranging from flying Quadcopters to levitating magnets and underwater robots. Currently, he splits his time between doing his undergraduate studies in electric engineering and computer science at Jacobs University in Bremen, Germany, and his start-ups and research and development job.
Read more about Cornel M Amariei

Right arrow

More digital pins


There are times when we need more digital pins on the Arduino without any other external components. An Arduino Uno has 14 digital pins, from 0 to 14, right? Wrong! It actually has 20. The analog in ports can at all times be used as digital ports, and they have all the functionality of normal digital ports.

Tip

A word of caution: pins 0 and 1 are the UART ports used for programming need to take extra care about what we connect there, because when we are programming the board, those pins will switch from HIGH to LOW thousands of times.

Getting ready

Just one ingredient is needed for this recipe—an Arduino Board connected to a computer via USB.

How to do it…

The following code shows how to use pins A0 and A1 as normal digital pins:

void setup(){
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT); 
}

void loop(){
  digitalWrite(A0, HIGH);
  digitalWrite(A1, LOW);
  delay(500); 

  digitalWrite(A0, LOW);
  digitalWrite(A1, HIGH);
  delay(500); 
}

How it works…

Internally, all pins on Arduino...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Arduino Development Cookbook
Published in: Apr 2015Publisher: ISBN-13: 9781783982943

Author (1)

author image
Cornel M Amariei

Cornel Amariei is a Romanian inventor and entrepreneur in the fields of Robotics and 3D printing. He has been working with the Arduino platform since its early days in 2007. His past experience involves large cargo gamma ray scanning robotics, ATM security systems, and blind assisting devices. In his spare time, he is a performing musician playing multiple instruments—predominately the guitar. He is also a swimmer, water polo player, and photographer. Over the years, he has built hundreds of Arduino projects, ranging from flying Quadcopters to levitating magnets and underwater robots. Currently, he splits his time between doing his undergraduate studies in electric engineering and computer science at Jacobs University in Bremen, Germany, and his start-ups and research and development job.
Read more about Cornel M Amariei