Skip to content

Lab 3: Digital I/O with an Arduino

May 25, 2009

The last lab just outputted a program through the Arduino.  This lab focuses on giving the Arduino some input and getting some output–what one might personify as a response.

I laid out the workspace, tools and parts:

IMG_7843

Started prepping the breadboard:

IMG_7846

And then got it all set up really fast without remembering to take any pictures along the way.  Probably best to keep this moving along anyway:

IMG_7847

IMG_7852

Then came programming.  It’s a pretty simple matter to cut and paste in the code Rory gave us, but it was a beautiful sunny Saturday so I figured I’d retype it as I’d probably learn something.

First off, if you type the code right, the program gives you a little pat on the back by changing the colors of the commands and highlighting the brackets that agree with each other (not unlike Excel).  I threw in a couple of typos to see if it mattered: didn’t leave any space around an “equals” sign, and didn’t capitalize “input”.  This was my 1st draft of the sketch:

Sketch Draft 1

Compiled, I got the following.  Not sure what it all means.  Fixing the typos didn’t help, nor did pasting in Rory’s sketch:

Sketch Draft 1 Compiled

 Rebooting the Arduino IDE fixed it though:

Sketch Draft 1 Post-Reload

Clearly the space around the “equals” sign doesn’t matter, but “input” needs to be capitalized.  I fixed that and recompiled:

Sketch Draft 2 Compiled

Ready to go.  Loaded it onto the Arduino, and voila.  I had to change the image capture venue due to said sunshine:

IMG_7858

That’s with switch open, so red LED is on.  Here’s switch closed, yellow LED on:

IMG_7860

Videos available on demand.

Regarding the “Get Creative” part of this lab, I’ve treated it as a conceptual problem for the moment.  

There are some pretty wild birds outside my window that get going every morning at what seems to me to be just before sunrise.  Anyway the alarm clock says 6:30 or so, and it’s not set to go off for another half hour at least.  I’d bet that despite the fact that they are living creatures, their chirping is pretty close to a repetitive pattern.  

I’d like to put my alarm clock inside a muffled safe with a combination lock anyway, so let’s get started: the Arduino could be programmed to listen for that chirping pattern, and then unlock the safe so that when the alarm does go off, it will remind me that the birds woke me up.

Once I’ve worked out the kinks, I’ll submit it to The Chindogu Society.

Alternatively, the Arduino could just be programmed to listen for an SOS input, and then unlock Johnny Sokko’s Flying Robot:

Picture 3

Advertisements
2 Comments
  1. Shawn permalink

    Who is Johnny Sokko and what is all of this about flying robots?

    • mfleisig permalink

      So much great TV, lost to future generations! We will have a 30- minute Johnny Sokko retrospective.

      Morgen Fleisig Oliver Cope Architect 151 West 26th Street, 8th Floor New York, NY 10001-6810 (212) 727-1225 (212) 675-5979 Fax

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: