0% found this document useful (0 votes)
45 views2 pages

Const Int NumLeds

The document contains an Arduino sketch that controls 14 LEDs connected to specified pins. In the setup function, it configures these pins as outputs, and in the loop function, it sequentially turns on each LED at full brightness, waits, then turns it off, while also turning on the next LED at reduced brightness. The process repeats for all LEDs with specified delays between actions.

Uploaded by

ismail.chamaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views2 pages

Const Int NumLeds

The document contains an Arduino sketch that controls 14 LEDs connected to specified pins. In the setup function, it configures these pins as outputs, and in the loop function, it sequentially turns on each LED at full brightness, waits, then turns it off, while also turning on the next LED at reduced brightness. The process repeats for all LEDs with specified delays between actions.

Uploaded by

ismail.chamaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

const int numLeds = 14; // Number of LEDs

const int ledPins[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; // Pin numbers for the LEDs

void setup() {

for (int i = 0; i < numLeds; i++) {

pinMode(ledPins[i], OUTPUT); // Configure LED pins as outputs

void loop() {

for (int i = 0; i < numLeds; i++) {

// Turn on the current LED at full brightness (255)

analogWrite(ledPins[i], 255);

// Wait for a specified time

delay(500);

// Turn off the current LED

analogWrite(ledPins[i], 0);

// Turn on the next LED at reduced brightness (128) if it's not the last one

if (i < numLeds - 1) {

analogWrite(ledPins[i + 1], 128);

// Wait for a specified time

delay(600);

// Turn off the next LED if it's not the last one
if (i < numLeds - 1) {

analogWrite(ledPins[i + 1], 0);

You might also like