How to blink an LED using Arduino
If you are a programmer, you know that the goal of any first program consists of writing enough code to show the sentence Hello World!
on a screen. The blinking LED is the Hello World!
of physical computing.
In this recipe, you will learn how write a Delphi application and the relative Arduino Sketch to send commands to your Arduino to make the Arduino's built-in LED blinking.
Getting ready
In this recipe, we have to communicate to the serial port to tell Arduino to turn the blinking LED light ON or OFF. To do this, we need a library/components for Serial Communications purposes—ComPort (https://sourceforge.net/projects/comport/). To install the ComPort library, perform the following steps:
- Download it from this link: https://sourceforge.net/projects/comport/
- Extract it in your preferred
Libs
folder (for example,D:\Dev\Delphi\Libs
) - Open the design time project,
DsgnCPortDXE.dpk
, and install it - Add the
source
folder of thisLibs
to theLibrary path
(F6 and...