Dimmer using an Arduino

This example shows how to send data from a personal computer to an Arduino board to control the brightness of an LED. The data is sent in individual bytes, each of which ranges in value from 0 to 255. Arduino reads these bytes and uses them to set the brightness of the LED.

Dimmer using an Arduino

You can send bytes to the Arduino from any software that can access the computer serial port. Examples for Processingand Max/MSP version 5 are shown below.

Software Required


An LED connected to pin 9. Use an appropriate resistor as needed. For most common LEDs, you can usually do without the resistor, as the current output of the digital I/O pins is limited.

image developed using Fritzing. For more circuit examples, see the Fritzing project page


Dimmer using an Arduino schematic



Demonstrates the sending data from the computer to the Arduino board,
in this case to control the brightness of an LED.  The data is sent
in individual bytes, each of which ranges from 0 to 255.  Arduino
reads these bytes and uses them to set the brightness of the LED.
The circuit:
LED attached from digital pin 9 to ground.
Serial connection to Processing, Max/MSP, or another serial application
created 2006
by David A. Mellis
modified 30 Aug 2011
by Tom Igoe and Scott Fitzgerald
This example code is in the public domain.
const int ledPin = 9;      // the pin that the LED is attached to
void setup()
// initialize the serial communication:
// initialize the ledPin as an output:
pinMode(ledPin, OUTPUT);
void loop() {
byte brightness;
// check if data has been sent from the computer:
if (Serial.available()) {
// read the most recent byte (which will be from 0 to 255):
brightness = Serial.read();
// set the brightness of the LED:
analogWrite(ledPin, brightness);

READ  How to Make Musical Floppy Drives using an Arduino

Major Components in Project

Hardware Required

  • Arduino Board
  • LED
  • 220 ohm resistor
For more detail: Dimmer using an Arduino

This Post / Project can also be found using search terms:

  • arduino dimmer schema
  • dimmer bluetooth arduino
  • https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1834 nmUdwoM8Jl1AZx34zCxFMiFttWwwXXbBdPQw2CLsvrNS2DeFC6s7jLnr68vM7XI6 574f1e882db297b8fa7e59170b28bf6d8e2f018f&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme
  • led dimmer arduino android

Leave a Comment

= 3 + 4

(Spamcheck Enabled)

Read previous post:
Mystery Beeping Prank

The Mystery Beeping Prank is a device hidden in a hollowed out book that beeps intermittently at different frequencies. I...

Scroll to top