/*DEMULTIPLEXER CO ANALOG INPUTS */
int sensorPin = A0; // Select the entry for the potentiometer Pinde
int ledPin = 13; // Led card
int led2Pin = 12; // Select the pin for the LED
int led3Pin = 11;
int led4Pin = 10;
int led5Pin = 9;
int led6Pin = 8;
int led7Pin = 7;
int led8Pin = 6;
int sensorValue = 0; // variable to store the value coming from the sensor
;
void setup()
{
// Declaración de ledPin como OUTPUT(salida):
pinMode(ledPin, OUTPUT);
pinMode(led2Pin, OUTPUT);
pinMode(led3Pin, OUTPUT);
pinMode(led4Pin, OUTPUT);
pinMode(led5Pin, OUTPUT);
pinMode(led6Pin, OUTPUT);
pinMode(led7Pin, OUTPUT);
pinMode(led8Pin, OUTPUT);
}
//-----1ra parte 'Demux' Todos los LED's en <LOW>-----
void loop()
{
sensorValue = analogRead(sensorPin); // read the value from the sensor: //Lee una variable análoga
digitalWrite(led8Pin, LOW);
digitalWrite(led7Pin, LOW);
digitalWrite(led6Pin, LOW);
digitalWrite(led5Pin, LOW);
digitalWrite(led4Pin, LOW);
digitalWrite(led3Pin, LOW);
digitalWrite(led2Pin, LOW);
digitalWrite(ledPin, LOW);
//-----2da Parte 'Demux' Cada LED en <HIGH> en forma secuenciada-------
digitalWrite(ledPin, HIGH); // turn the ledPin on //ledPin se pone en modo <HIGH>(encendido)
delay(sensorValue);// detiene el programa por milisegundos asignados a <sensorValue>:
digitalWrite(ledPin, LOW);// turn the ledPin off //ledPin se pone en modo <LOW>(apagado)
delay(sensorValue);
digitalWrite(led2Pin, HIGH);
delay(sensorValue);
digitalWrite(led2Pin, LOW);
delay(sensorValue);
digitalWrite(led3Pin, HIGH);
delay(sensorValue);
digitalWrite(led3Pin, LOW);
delay(sensorValue);
digitalWrite(led4Pin, HIGH);
delay(sensorValue);
digitalWrite(led4Pin, LOW);
delay(sensorValue);
digitalWrite(led5Pin, HIGH);
delay(sensorValue);
digitalWrite(led5Pin, LOW);
delay(sensorValue);
digitalWrite(led6Pin, HIGH);
delay(sensorValue);
digitalWrite(led6Pin, LOW);
delay(sensorValue);
digitalWrite(led7Pin, HIGH);
delay(sensorValue);
digitalWrite(led7Pin, LOW);
delay(sensorValue);
digitalWrite(led8Pin, HIGH);
delay(sensorValue);
digitalWrite(led8Pin, LOW);
delay(sensorValue);
//-----------3ra Parte 'Demux' Todos los LED's en <LOW>----------------
digitalWrite(led8Pin, LOW);
delay(sensorValue);
digitalWrite(led7Pin, LOW);
delay(sensorValue);
digitalWrite(led6Pin, LOW);
delay(sensorValue);
digitalWrite(led5Pin, LOW);
delay(sensorValue);
digitalWrite(led4Pin, LOW);
delay(sensorValue);
digitalWrite(led3Pin, LOW);
delay(sensorValue);
digitalWrite(led2Pin, LOW);
delay(sensorValue);
digitalWrite(ledPin, LOW);
delay(sensorValue);
//-----4ta Parte 'Demux' LED's en <HIGH> y después en <LOW> por pares-----
digitalWrite(led8Pin, HIGH);
delay(sensorValue);
digitalWrite(led8Pin, HIGH);
digitalWrite(led7Pin, HIGH);
delay(sensorValue);
//---------------------------------------------
digitalWrite(led8Pin, LOW);
digitalWrite(led7Pin, LOW);
delay(sensorValue);
digitalWrite(led6Pin, HIGH);
digitalWrite(led5Pin, HIGH);
delay(sensorValue);
//---------------------------------------------
digitalWrite(led6Pin, LOW);
digitalWrite(led5Pin, LOW);
delay(sensorValue);
digitalWrite(led4Pin, HIGH);
digitalWrite(led3Pin, HIGH);
delay(sensorValue);
//---------------------------------------------
digitalWrite(led4Pin, LOW);
digitalWrite(led3Pin, LOW);
delay(sensorValue);
digitalWrite(led2Pin, HIGH);
digitalWrite(ledPin, HIGH);
delay(sensorValue);
//---------------------------------------------
digitalWrite(led2Pin, LOW);
digitalWrite(ledPin, LOW);
delay(sensorValue);
}//fin del ciclo
int sensorPin = A0; // Select the entry for the potentiometer Pinde
int ledPin = 13; // Led card
int led2Pin = 12; // Select the pin for the LED
int led3Pin = 11;
int led4Pin = 10;
int led5Pin = 9;
int led6Pin = 8;
int led7Pin = 7;
int led8Pin = 6;
int sensorValue = 0; // variable to store the value coming from the sensor
;
void setup()
{
// Declaración de ledPin como OUTPUT(salida):
pinMode(ledPin, OUTPUT);
pinMode(led2Pin, OUTPUT);
pinMode(led3Pin, OUTPUT);
pinMode(led4Pin, OUTPUT);
pinMode(led5Pin, OUTPUT);
pinMode(led6Pin, OUTPUT);
pinMode(led7Pin, OUTPUT);
pinMode(led8Pin, OUTPUT);
}
//-----1ra parte 'Demux' Todos los LED's en <LOW>-----
void loop()
{
sensorValue = analogRead(sensorPin); // read the value from the sensor: //Lee una variable análoga
digitalWrite(led8Pin, LOW);
digitalWrite(led7Pin, LOW);
digitalWrite(led6Pin, LOW);
digitalWrite(led5Pin, LOW);
digitalWrite(led4Pin, LOW);
digitalWrite(led3Pin, LOW);
digitalWrite(led2Pin, LOW);
digitalWrite(ledPin, LOW);
//-----2da Parte 'Demux' Cada LED en <HIGH> en forma secuenciada-------
digitalWrite(ledPin, HIGH); // turn the ledPin on //ledPin se pone en modo <HIGH>(encendido)
delay(sensorValue);// detiene el programa por milisegundos asignados a <sensorValue>:
digitalWrite(ledPin, LOW);// turn the ledPin off //ledPin se pone en modo <LOW>(apagado)
delay(sensorValue);
digitalWrite(led2Pin, HIGH);
delay(sensorValue);
digitalWrite(led2Pin, LOW);
delay(sensorValue);
digitalWrite(led3Pin, HIGH);
delay(sensorValue);
digitalWrite(led3Pin, LOW);
delay(sensorValue);
digitalWrite(led4Pin, HIGH);
delay(sensorValue);
digitalWrite(led4Pin, LOW);
delay(sensorValue);
digitalWrite(led5Pin, HIGH);
delay(sensorValue);
digitalWrite(led5Pin, LOW);
delay(sensorValue);
digitalWrite(led6Pin, HIGH);
delay(sensorValue);
digitalWrite(led6Pin, LOW);
delay(sensorValue);
digitalWrite(led7Pin, HIGH);
delay(sensorValue);
digitalWrite(led7Pin, LOW);
delay(sensorValue);
digitalWrite(led8Pin, HIGH);
delay(sensorValue);
digitalWrite(led8Pin, LOW);
delay(sensorValue);
//-----------3ra Parte 'Demux' Todos los LED's en <LOW>----------------
digitalWrite(led8Pin, LOW);
delay(sensorValue);
digitalWrite(led7Pin, LOW);
delay(sensorValue);
digitalWrite(led6Pin, LOW);
delay(sensorValue);
digitalWrite(led5Pin, LOW);
delay(sensorValue);
digitalWrite(led4Pin, LOW);
delay(sensorValue);
digitalWrite(led3Pin, LOW);
delay(sensorValue);
digitalWrite(led2Pin, LOW);
delay(sensorValue);
digitalWrite(ledPin, LOW);
delay(sensorValue);
//-----4ta Parte 'Demux' LED's en <HIGH> y después en <LOW> por pares-----
digitalWrite(led8Pin, HIGH);
delay(sensorValue);
digitalWrite(led8Pin, HIGH);
digitalWrite(led7Pin, HIGH);
delay(sensorValue);
//---------------------------------------------
digitalWrite(led8Pin, LOW);
digitalWrite(led7Pin, LOW);
delay(sensorValue);
digitalWrite(led6Pin, HIGH);
digitalWrite(led5Pin, HIGH);
delay(sensorValue);
//---------------------------------------------
digitalWrite(led6Pin, LOW);
digitalWrite(led5Pin, LOW);
delay(sensorValue);
digitalWrite(led4Pin, HIGH);
digitalWrite(led3Pin, HIGH);
delay(sensorValue);
//---------------------------------------------
digitalWrite(led4Pin, LOW);
digitalWrite(led3Pin, LOW);
delay(sensorValue);
digitalWrite(led2Pin, HIGH);
digitalWrite(ledPin, HIGH);
delay(sensorValue);
//---------------------------------------------
digitalWrite(led2Pin, LOW);
digitalWrite(ledPin, LOW);
delay(sensorValue);
}//fin del ciclo