/ arduino

First Arduino Project: Blinking LED

It is really exciting to do even small hardware project after so many years of software development. That's what I can say after making LED blinks with Arduino. That's the story how I made it.

A few months ago, while on vacation, I bought the localised Arduino starting kit with Arduino, breadboard (it is a board with array of holes) and many small electrical parts and wires. Arduino and breakboard being assembled together on a platform looks like this:

1.board

The guide recommends to download the Arduino IDE. Surprisingly, it is not necessary - it is possible to write code for the board just in browser with Arduino Web Editor. It compiles code in the cloud and then uploads the bytecode directly to the board right from the web page. Of course it is done through the plugin that is need to be installed in order to support this functionality.

Screen-Shot-2017-08-30-at-22.43.49

When the editor starts, the board model should be selected in the list. When the board is connected, it should be possible to just verify and send the code to the board with single click on the button with arrow.

The simplest example is, probably, Blink. It only requires one 220 ohm resistor, LED and couple of connectors. It is simple, but playing with different LED timing is fun.

That is what is needed:

2.parts

Make sure that it is 220 om resitor by checking its colors.

Now bend the resistor legs. It should look like this:

3.resistor

Connect the pin no. 13 with resistor, connect another resitor leg with longer LED's leg and finally connect shorter LED's leg with the ground.

Breadboard with all things connected:

4.done

After copying the example code to the editor and uploading it to the board it should start blinking. If it is not, then check the LED. It may be inserted incorrectly.

By combining the delays and power levels it is possible to send messages with Morse Code.

// https://en.wikipedia.org/wiki/Morse_code
void lA() { p(); s1(); ddd(); }
void lB() { ddd(); s1(); p(); s1(); p(); s1(); p(); }
void lC() { ddd(); s1(); p(); s1(); ddd(); s1(); p(); }
void lD() { ddd(); s1(); p(); s1(); p(); }
void lE() { p(); }
void lF() { p(); s1(); p(); s1(); ddd(); s1(); p(); }
void lG() { ddd(); s1(); ddd(); s1(); p(); }
void lH() { p(); s1(); p(); s1(); p(); s1(); p(); }
void lI() { p(); s1(); p(); }
void lJ() { p(); s1(); ddd(); s1(); ddd(); s1(); ddd();}
void lK() { ddd(); s1(); p(); s1(); ddd(); }
void lL() { p(); s1(); ddd(); s1(); p(); s1(); p(); }
void lM() { ddd(); s1(); ddd(); }
void lN() { ddd(); s1(); p(); }
void lO() { ddd(); s1(); ddd(); s1(); ddd(); }
void lP() { p(); s1(); ddd(); s1(); ddd(); s1(); p(); }
void lQ() { ddd(); s1(); ddd(); s1(); p(); s1(); ddd(); }
void lR() { p(); s1(); ddd(); s1(); p(); }
void lS() { p(); s1(); p(); s1(); p(); }
void lT() { ddd(); }
void lU() { p(); s1(); p(); s1(); ddd(); }
void lV() { p(); s1(); p(); s1(); p(); s1(); ddd(); }
void lW() { p(); s1(); ddd(); s1(); ddd(); }
void lX() { ddd(); s1(); p(); s1(); p(); s1(); ddd(); }
void lY() { ddd(); s1(); p(); s1(); ddd(); s1(); ddd(); }
void lZ() { ddd(); s1(); ddd(); s1(); p(); s1(); p(); }

void p() { digitalWrite(13, HIGH); u(); digitalWrite(13, LOW); }
void ddd() { digitalWrite(13, HIGH); u(); u(); u(); digitalWrite(13, LOW); }
void s1() { u(); }
void s3() { u(); u(); u(); }
void s7() { u(); u(); u(); u(); u(); u(); u(); }
void u() { delay(250); }

Now combine the message:

void _HELLO() { lH(); s3(); lE(); s3(); lL(); s3(); lL(); s3(); lO(); }
void _HUMANS() { lH(); s3(); lU(); s3(); lM(); s3(); lA(); s3(); lN(); s3(); lS(); }

And start sending it:

void loop() {
  _HELLO(); s7(); _HUMANS();
}

5.hi

Alex Netkachov

Alex Netkachov

Alex Netkachov is a Senior Software Developer, currently working in Central London on new generation of energy trading solutions for brokers, traders and exchanges.

Read More

Why not to chat about this post? Join Telegram group Alex@Net or message on Twitter to alex_at_net. Alternatively, use the comments form below.