LED Control Using Touch Button

In this project, we will learn how to turn an LED ON or OFF via the 4Duino I/O port (D13) and a button widget from 4D Workshops. The 4Duino’s resistive touch display is used as a means for a graphical interface to control state of the LED. For convenience, we will use the LED on pin D13 of the 4Duino to conduct this project. An LED (light emitting diode) works on the basic principle that when potential difference is applied across the anode and cathode, light is emitted. The higher the potential difference, the brighter the LED shines. LEDs being diodes have polarity and will only work if current flows from the anode to the cathode, therefore positive must always be connected to the anode and ground to the cathode. The longer lead of the LED is the anode whilst the shorter lead is the cathode. A resistor is typically placed before the anode in order to lower the current flowing through the LED. This will extend the lifespan of the LED and dim the brightness to a level that is more comfortable to look at.

LED Control Using Touch Button

Note: If you end up clipping the leads, the anode lead can be found by looking inside the LED and examining the metal contacts – the larger contact is the cathode. The plastic casing of the LED can be used to determine polarity on the LED as well – the side of the cathode will have a flat edge.



This projects utilizes the internal circuitry of the 4Duino, hence no external components is required for this project. However, you will require a Micro USB cable to program the 4Duino.


Step 1: Build

4Duino has an inbuilt LED connected to the I/O pin D13. Circuit building is not required at this stage.

Step 2: Program

Workshop 4 – 4Duino Basic Graphics environment is used to program this project. (The same could be implemented in the latest Arduino IDE)

LED Control Using Touch Button schematic

This project requires the Arduino IDE to be installed as Workshop calls the Arduino IDE for compiling the Arduino sketches. The Arduino IDE however is not required to be opened or modified to program the 4Duino.

Read more: LED Control Using Touch Button

Leave a Comment

= 4 + 2

(Spamcheck Enabled)

Read previous post:
IoT Smart Socket Arduino And Cayenne
IoT Smart Socket Arduino And Cayenne

A really smart IoT socket. Switch ON/OFF your device by the smartphone using Cayenne Dashboard and Arduino MKR1000. Things used...

Scroll to top