You are on page 1of 5

// these constants won't change:

const int analogPin = A0; // the pin that the potentiometer is attached to

const int ledCount = 12; // the number of LEDs in the bar graph

int ledPins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11,12,13};

// an array of pin numbers to which LEDs are attached

void setup() {

// loop over the pin array and set them all to output:

for (int thisLed = 0; thisLed < ledCount; thisLed++) {

pinMode(ledPins[thisLed], OUTPUT);

Serial.begin(9600);

void loop() {

// read the potentiometer:

int sensorReading = analogRead(analogPin);

// map the result to a range from 0 to the number of LEDs:

int ledLevel = map(sensorReading, 0, 1023, 0, ledCount);

// loop over the LED array:

for (int thisLed = 0; thisLed < ledCount; thisLed++) {

// if the array element's index is less than ledLevel,

// turn the pin for this element on:

if (thisLed < ledLevel) {

digitalWrite(ledPins[thisLed], HIGH);

}
// turn off all pins higher than the ledLevel:

else {

digitalWrite(ledPins[thisLed], LOW);

const int analogpin=A0;

const int pot=0;

const int ledContador = 15;

int ledbrillo=

(000000000000000);

(100000000000000);

(110000000000000);

(111000000000000);

(111100000000000);

(111110000000000);

(111111000000000);

(111111100000000);
(111111110000000);

(111111111000000);

(111111111100000);

(111111111110000);

(111111111111000);

(111111111111100);

(111111111111110);

(111111111111111);

void setup()

for (int l=2; l<=15; l++);

pinMode(l,OUTPUT);

Serial.begin(9600);

int pot;

int led1=2;

int led2=3;

int led3=4;

int led4=5;

int led5=6;

int led6=7;

int led7=8;

int led8=9;
int led9=10;

int led10=11;

int led11=12;

int led12=13;

int ledcontador[]={led1,led2,led3,led4,led5,led6,led7,led8,led9,led10,led11,led12};

int i;

void setup()

for (i=2; i<=16; i++){

pinMode(ledcontador,OUTPUT);

Serial.begin(9600);

void loop()

digitalWrite(ledcontador,1);

Serial.println(i);

int led1=2;

int led2=3;

int led3=4;
int led4=5;

int led5=6;

int led6=7;

int led7=8;

int led8=9;

int led9=10;

int led10=11;

int led11=12;

int led12=13;

int led13=A1;

int led14=A2;

int led15=A3;

You might also like