Arduino – First Experience

All across the web I see these Arduino projects, Arduino here and Arduino there, so I wanted to try it myself. Exactly then,┬áCoursera offered me to try a course called “The Arduino platform and C programming”, by University of ┬áCalifornia, Irving, taught by prof. Ian Harris.

This course didn’t give me a lot of new information, but I can say that Ian Harris is an excellent teacher, and if you know nothing about Embedded systems, then this course is for you.

So I ordered a “clone” of the Arduino Uno – Arduino is an open hardware project, so anyone can build it himself. I bought it from “Freenove”, and there is actually no difference between this one and the “original”… except of the price. Freenove’s Uno costs third of the original (which isn’t much anyway).
It came with an A-B USB cable for connecting the Arduino to the PC.
I put an AA battery alongside the Arduino to demonstrate its small size.


I installed the “Arduino Studio” software. The development is done in C (C++ actually, but knowing C is enough), and there are built-in library functions for doing stuff like assigning a value to a pin and checking a value of a pin, all described in Arduino’s reference. This enables an easy access to all of the embedded features of the platform.

After playing a little with the “blink” tutorial “sketch” (Arduino project), I tried to build my own “Hello world” project – Magnet “detector”.
In my project there’s an LED and a magnet switch – A switch that is turned on only when a magnet is nearby. The LED light will be on, and when a magnet is detected, the LED will go off.
Actually, you can build a very simple circuit that does exactly this without using any embedded stuff, but nevermind. Here is my “schematics”:


I didn’t even bother to check the exact values for the resistors. It was few hundreds for the LED, and few K’s for the switch.
P9’s value is passed to P8. When the switch is OFF, the value in P9 is HIGH, and the LED light is on. When there’s a magnet near the switch, it turns on, and P9 value becomes LOW, so that the LED light will be turned off.

There are two parts for an Arduino “sketch” – “setup” and “loop”.
In “setup” you initialize all the stuff that needs initializing. In our case, we need to set P8 as output and P9 as input.
In “loop” you put the logic itself. In our case, reading P9 and setting the read value to P8.

[Yeah, I know I should have insert a delay in the loop (to save power), but again – “Hello world”, didn’t bother]

This is the program I wrote, I took a screenshot in order to give a look of the “Arduino Studio”:program

All in all, it took my less than 10 minutes to build and test the whole projects (including looking for the HW components in my workbox…). So I definitely can say that the Arduino seems like a really easy-to-use development platform.

And I’ll end this post with a demonstration of my a-m-a-z-i-n-g project: