Home > Tutorials > Week #01 – Blinking a LED

Week #01 – Blinking a LED

#There will be a tutorial every week that helps you learn Arduino with me.

As for every programmer, things are started at a “Hello World!“. However, for us, electrical engineer/hobbysts, we start with other thing, we light up a LED.

(1) Objectives (lesson targets)

– Learn the very basics of Arduino coding.

– We will need to light up a LED.

– Be able to blink it.

(2) Requirements (things to prepare)

– An Arduino board, I use Arduino UNO, you pick your own kinds, any will do.

– A LED light.

– The adapter cable to connect PC to Arduino.

– Visual Studio w/ Arduino plugin installed (if you don’t have, refer to my previous article – Arduino Plugin for Visual Studio)

#assuming that you’re already had experiences in programming C/C++.

(3) Setup (connect devices and objects)



– Use cable to connect PC and Arduino board.

– For LED, plug the long leg to pin 13, the short leg to the GND (stands for “ground”).

(4) Source

– Create a new Arduino project and run the below code:

 * @author		Pete Houston
 * @homepage	https://tronixino.wordpress.com/
 * @objective	blink a LED

/** constants **/
const int PIN_LED = 13;	// port to use for LED
const int TIME_DELAY = 1000; // 1000 ms

/** setup **/
void setup()
	// set OUTPUT mode for port 13
	pinMode(PIN_LED, OUTPUT);

/** loop **/
void loop()
	// light up the LED
	digitalWrite(PIN_LED, HIGH);
	// wait for a second
	// turn the ligh
	digitalWrite(PIN_LED, LOW);
	// wait for a second)

(5) Execution

– Click F5 on Visual Studio to compile and upload to the Arduino board.

– You see the result as expect, the LED blinking every second.

(6) Final words

– This lesson is pretty much simple and easy, but if you’re absolutely new to this stuff, I’d suggest you try to read and follow properly. Also, use Google to learn and know a bit about things you don’t know in this lesson; it certainly helps you more in future stuffs.

– Do it, think it and mix it to complete!


Pete Houston

Categories: Tutorials Tags: , , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: