Don’t Fear the Code Reaper

posted in: Arduino, Intro | 5

As promised in the last post, today we are going to have The Talk about programming. So grab a log and put in on the fire, come on over here little whipper-snapper and listen close as ‘ole dad Roby tells you a story or two.

Roby's Sister
Roby’s Sister is a Math Expert and Perfectly Happy Without Programming

First off, I’d like to introduce you to my sister. She teaches algebra/geometry/calculus at the local high school. She graduated #1 from both her high school and undergraduate college class. She’s also picked up a master’s degree of some kind. I think the last time she made anything less than an A in class was 5th grade.

I don’t mention Sister to remember my own less-than-perfect academic record, or to give you a picture of an ideal programmer. Get this: Sister is NOT a programmer. She is not interested in programming. She’s got a good gig teaching and she doesn’t want to hear about software. She’ll live a wonderfully fulfilling life without writing a line of code.

Secondly, let me introduce you to my buddy Civil. Civil studied civil engineering at my alma mater, then went on to earn a Master’s degree from Georgia Tech in some nuanced form of engineering that I can neither remember nor pronounce.

The other night at church, I was talking with Civil about a new robotics project he’s tinkering with, and we had a conversation that went something like this:

Civil: I need to make the robot do X

Roby: That’s easy, just do that with software

Civil: Man, I’m not a programmer

Roby: What? Software is easy! Software isn’t nearly as hard as your Master’s from Georgia Tech!

Civil: (Looks dejected, appears suspicious of Roby’s claim)

So why did I introduce you to Sister and Civil? We’re illustrating this point: many people (perhaps most people) who excel at highly technical disciplines have some nervousness about software in general and writing software in particular. Wow, that sentence sounds just like something a programmer would write. Let’s restate that and make a bold claim:

Most Humans Have Codeaphobia

The truth is, I think there are many valid reasons that Codeaphobia has spread across the human race. Here are a few:

Do you really see me?
Hello, I’m Your Favorite App!

1. Software is Invisible — Why are kids (and grownups) afraid of the dark? It’s unknown, you don’t know what’s around the corner, what will spring up next. Of course, you can see the apps on your phone, but where do they really live? If you find where they live in your filesystem, what will you see? Some file names on a screen. But what do those file names on the screen really mean? In the end they’re saved as billions of 1s and 0s on some storage device. Now, of course, you know that if you physically look at your phone’s internal storage, it won’t look any different after you delete the Facebook app. You may think this is far-fetched, but I’m inclined to think that software’s invisible and evasive nature triggers some deep human fear.

Here's looking at you, IE!2. Bad Experiences — While doing your taxes the tax software won’t let you view a particular form. Your bank software won’t let you easily search across all transactions. You wrote a 2000 word essay, nearly Pulitzer quality, software crashed and you lost the whole thing. You probably don’t have to think very hard to remember some time that software has burned you.

Have you tried your hand at a little Arduino programming only to find that you spent hours trying to get the most simple program compile? Perhaps you lost invested a full evening trying to get some code running, and finally realized that all of your problems were caused by a missing semi-colon. These kinds of experiences are simply a part of learning to write code — and we should also point out that even experienced programmers often spend significant unintended effort on seemingly trivial issues.

 

3. Software Guys1 Are Jerks — OK, that’s really a tough point for a career programmer to make. Hey, let’s play the word-associate game! I’ll start:

Roby: Programmer

You: [ ? ]

What did you think when you read “Programmer”? If you’re not a career programmer, I’ll venture a guess: “Smart”, “Nerd”, “Narrow”, “Anti-Social”. Gracious, let’s stop this game!

While there are notable charismatic exceptions, the stereotype of a programmer as a less-wealthy version of Bill Gates is probably well-earned. SNL got it right, the computer guy is often not the friendliest fellow.

But now that I’ve taken two apparent shots at Bill Gates (IE logo above being first), let’s push back on that a little. What, after all, is Bill Gates’ life trajectory? In a nutshell: start company, company is key in all of human history to making computers approachable for hundreds of millions of average folks (thus unlocking untold potential for said folks), become richest man on the planet, leave company and dedicate vast mental/financial resources to helping out disadvantaged people. I remember reading a few years back that Gates was reading feverishly about cancer research in an effort to help out with cancer treatment development.

Bill Gates is a deeply decent guy. Is it fair to suggest that, while your programmer buddy may often act like Nick Burns from SNL, that, perhaps, he would take a bullet for you? My observation from years of knowing programmers is that the superficial stereotype is dead-on, but beneath the surface a programmer is often a good person worthy of your trust.

While we programmers may act like our knowledge of all things computer-related is complete, we know it is not. All good programmers know their technological ignorance is embarrassingly profound. If you’ve never written 1 line of code, please don’t let the unfounded belief that you’ll never be able write good quality code (like your “super genius” software buddy is undoubtably capable of effortlessly producing) keep you from writing your first Arduino program.

Assembly Code -- Daunting Reputation Well Deserved
Assembly Code — Daunting Reputation Well Deserved

4. Code is Cryptic — Yes, code often looks and behaves in ways that simply aren’t otherwise common to the human experience. Think of this as opposed to building a bridge. My buddy Civil undoubtably knows countless nuances about successful bridge construction, but a hack like me is naturally tempted to look at a bridge and arrogantly think I more-or-less understand what it takes to build a good bridge.

Sister has spent half a career figuring out the best ways to teach energetic hormonal teenagers about mathematics, but I’m tempted to think “hey, that’s not hard, you just tell them the equations, do some examples, be firm but not too tough, relatable but not too familiar, and BAM! It’s easy to be a world-class teacher!”

While we often wildly overestimate our abilities in a variety of other disciplines, the average human is often inclined to grossly underestimate his or her potential coding abilities. Perhaps part of this phenomena is that, when starting out, code looks like Hieroglyphics.

Two quick points: first, modern programming languages are much more readable than that cryptic nightmare above. Second, Joel taught us long ago that code is harder to read than to write. I know that’s a tough one for a non-programmer to believe, but it actually is easier to write code than to read it.

The Cure for Codeaphobia

I’m convinced that if you simply start programming (as we’re going to do) and if you commit to writing code as a craft worthy of pursuit, that before long, you’ll look up and find yourself to be unusually proficient in a field you once regarded as unapproachable.

One time I heard Warren Buffett say that a 115 IQ is all you need to be a great investor — that sustained success in investing is more related to disposition than IQ. Similarly, I believe that successful programming is much more about disposition than IQ. If you want to learn to write code well, and you’re willing to commit to lifetime learning, then you’re going to become a remarkably talented programmer.

Enough Talk — Let’s Roll!

So we want to immediately write some simple code for the Arduino. Here are the steps to follow:

  1. Purchase an Arduino Uno
  2. Download & Install the Arduino IDE from here
  3. Connect your Arduino to your computer via a USB cable like this:Arduino Connected to Mac
  4. Open the Arduino IDE
  5. In Arduino IDE’s top bar, click Tools –> Board –> Arduino/Genuino Uno
  6. In Arduino IDE’s top bar, click Tools –> Port –> (Select your Arduino Port — below is a screenshot of mine)
  7. In Arduino IDE’s top bar, click File –> New (this will create a new “sketch” which is what we call the Arduino code)
  8. Replace the all of the code in your sketch (created in step #7) with this code:
    // Code from https://www.arduino.cc/en/tutorial/blink
    // the setup function runs once when you press reset or power the board
    void setup() {
      // initialize digital pin LED_BUILTIN as an output.
      pinMode(LED_BUILTIN, OUTPUT);
    }
    
    // the loop function runs over and over again forever
    void loop() {
      digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);                       // wait for a second
      digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
      delay(1000);                       // wait for a second
    }
    
  9. In Arduino IDE’s top bar, click File –> Save (name it whatever you’d like)
  10. In Arduino IDE’s top bar, click Sketch –> Upload

If all goes well, then you should see an LED on your Arduino blinking on (for 1 second) and off (for 1 second). Did all not go well? Are you running into a problem? Congratulations, then this really is a perfect introduction to programming! If you hang in there and hammer away (and use your Google skills), you’ll get the code above running on your Arduino. You’ll know it when you see that beautiful LED light blinking.

Let’s wrap up today’s discussion on that note. Next time we’ll jump in head-first to some serious Arduino fun.

Until then,

Sincerely yours,

Roby

 

Notes


  1. The masculine noun is intentional — for whatever reason I don’t think of software ladies as being quite as jerkish as we guys can be.
Follow Roby:

Latest posts from

5 Responses

  1. I have an arduino UNO connected to my windows 8 pc with the software downloaded but it won’t see the darn com port. I hate that version of windows! Finally moved to another PC and it appeared right away.

    • I’ve often found COM ports to be somewhat fickle. For instance: when writing this blog post at one point the Arduino IDE wouldn’t recognize the Arduino pictured — I ended up rebooting the computer (it’s a Mac) and the Arduino IDE saw the Arduino after reboot. Perhaps a late night COM communication research deep dive is in order?!

  2. Ha or not! Love that SNL sketch btw. I knew an IT guy just like that.

  3. I just bit the bullet and ordered a new UNO. All is well now (except for the wife asking why I needed it). Need/want doesn’t translate well to her when it comes to projects. We need bread and I need an arduino….

    • Completely understand Golfman. Now it’s like waiting for Christmas ’till your shiny new Arduino shows up in the mailbox.

Leave a Reply