Thursday, June 23, 2011

Arduino Microcontrollers

When I first saw these tiny electronics development platforms I was amazed. I've searched around on the net for more info and examples of people that made something with it. I found a lot of text, books, videos etc. explaining and showcasing the Arduino family of micro-controllers.

So what is an Arduino?

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.

I couldn't resist, so I've ordered one and got it today.

Here is the official Arduino website: LINK
You'll find there all the info you'll need to start creating stuff with it.

A cool and very interesting creation I've found, was a tiny solar panel that was tracking the sun and it was self-powered.

While I have programming/scripting experience with PHP, the Arduino's hardware is programmable via a language similar to C++. Which I don't know. Since programming logic is fundamentally the same and language independent (mostly) I did some research on C++ and wrote a simple SOS Morse Code program and uploaded it onto the Arduino board.

Here is the vid with the built in LED flashing. ( turn volume down, it's noisy )

And here is the code...

void setup() {
  pinMode(13, OUTPUT);
void loop() {
  int morseDot = 300; // Dot duration in ms
  int morseDash = 3 * morseDot; // Dash duration in ms
  int morseGap = morseDot; // Pause between characters
  int morseSGap = morseDash; // Pause between characters
  int morseMGap = 7 * morseDot; // Pause between words

  int msg[][5] = {
    {morseDot, morseDot, morseDot},
    {morseDash, morseDash, morseDash},
    {morseDot, morseDot, morseDot}

  for(int i = 0; i < sizeof msg/sizeof *msg; i++) {
    for(int x = 0; x < 5; x++) {
      if(msg[i][x] > 0) {
        // LED ON
        digitalWrite(13, HIGH);
        // LED OFF
        digitalWrite(13, LOW);

There might be a better way to write a Morse Code program but this does flash the LED with SOS morse code :D

Just Google Arduino and you'll find tons of information related to Arduino development., what should I make? :)

No comments:

Post a Comment

Leave a comment...