A First Sketch in Arduino

It’s been more than a month since I last updated my blog, that’s bad. I’ve been a little busy with life and stuff and also ran into some unexpected challenges that come with keeping a technical blog (which is what I think my blog is) but now I hope I’ll be able to keep this ball rolling more consistently (don’t hold me to that though).

Today I’ll basically be talking about, well the typical first program you’d run on an Arduino as a beginner. I think it’s one of those “stuff you do first” things, like when you are learning to code, the first program you write is “Hello World” and stuff like that. Oh, and I should mention, when speaking in Arduino lingo, programs are actually called sketches (I should find out it’s etymology).

Now in order to write a sketch for Arduino, you need to get the Arduino IDE (Integrated Development Environment), which you can download from the Arduino website

Today’s sketch will be an extremely simple one, not doing anything fancy and all (let’s leave the fancy stuff for later shall we). All we’ll be doing is… turning an LED on and off, in a loop.

There are two ways to run this sketch: the “automatic” way and the “manual” way.

The “Automatic” Way

In the automatic way all you do is open up the Arduino IDE and Navigate to File -> Examples -> 01. Basics -> Blink

Navigating to the Example Code

And voilà, you have your code

The code, all ready for uploading

Then all you have to do is compile and upload your code to the Arduino and watch the magic happen!

The “Manual” Way

Well, the “manual” way is just you typing out the actual code which you get at the end of the above procedure.

The Code

Then all you do is compile and run.
It’s really all that simple. I think typing out the code is good practice especially if you are a beginner because you could try understanding what the code means. I did play around with the combination of ‘on’ and ‘off’ delays just so that I got a feel that I did something :). Also, if you really mess around with the on and off delays, you discover something really cool. I’ll tell you all about it next time (yes, I am baiting you to return *evil smile*).

Leave a Reply

Your email address will not be published. Required fields are marked *