Channels ▼

Al Williams

Dr. Dobb's Bloggers

By Any Other Name

January 27, 2012

When I got started in computers, we were sort of like mysterious high priests and I think I liked it better. Today, computer professionals either are under intense scrutiny from suits, or lumped in with someone's nine year old who is "a regular computer whiz."

Even our little embedded niche has been invaded over the years. High school kids make robots, and "makers" play with Basic Stamps and Arduinos. It is surreal to get a question about reading a temperature sensor via SPI while in line at the grocery store.

Don't get me wrong, I have worked with many student groups and I like the Basic Stamp for simple one-off projects. (I’ve even written a few books about the Basic Stamp.) The Arduino, on the other hand, really annoys me. If you haven't run into the Arduino, it is a simple development board aimed at hobbyists. The circuit is simple but the real thing of interest is the built-in bootloader that communicates with the development environment via a serial port. Because of the bootloader, you don't need a programmer, just some software on your PC.

The idea is fine. I like the Atmel CPUs that power the Arduino. I have designed several systems with bootloaders myself. But what annoys me about the Arduino is that it introduces beginners to unnecessarily wrong terminology. When someone stops you at a coffee shop and asks you an Arduino-related question, you'll be glad for this Arduino to normal cheat sheet:

  • Wiring — the GNU C compiler with a simple IDE that knows how to talk to the Arduino bootloader
  • Sketch — A C program for the Arduino
  • Shield — a daughterboard that fits many Arduino boards to add some extra hardware

Don't be fooled. Sketch sounds like something graphical, but it is just a C source file. Well, sort of. The Arduino library has code that must look something like this:


int main(void)
{
	init();

	setup();
    
	for (;;)
		loop();
	  
	return 0;
}

Not really rocket science. Any code you want to run once, you put in the setup function (init is used by the library). Any code you want to repeat over and over goes in loop. The library also has a nice set of calls to control the onboard hardware (what we would call a board support package). A typical LED blinker looks something like this:


int led= 13;                 // LED on many Arduino boards

void setup()                  // do this once
{
  pinMode(led, OUTPUT);      // digital port to an output
}

void loop()
{
  digitalWrite(led, HIGH);      // LED on
  delay(200);                // wait for 200ms
  digitalWrite(led, LOW);      // LED off
  delay(200);                // 200 more ms
}

So the verdict? The Arduino isn't a bad choice for its intended market segment. I'm not entirely sure how it attained near cult status. I just wish it didn't teach bad habits.

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video