#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”).
– 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 **/
// set OUTPUT mode for port 13
/** loop **/
// light up the LED
// wait for a second
// turn the ligh
// wait for a second)
– 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!