Posts Tagged ‘ faster IO ’

Faster IO on the Arduino

10/11/2011

This article will show you how to control the Arduino IO pins faster, a lot faster.

We all know we can use the digitalWrite() command to set an IO pin high or low. Before we do any mods lets do some measurement to see how long it takes.

With a simple sketch to output a square wave on digital pin 2.

int outPin = 2; // Use digital pin 2 as output
void setup()
{
  pinMode(outPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  digitalWrite(outPin, HIGH);   // sets output high
  digitalWrite(outPin, LOW);    // sets output low
}

To measure the time it takes to set the output pin high then low, ¬†we’re going to use a Saleae Logic Analyzer.

Output waveform of Digital pin 2 using digitalWrite().

Read more »