33 lines
831 B
Arduino
33 lines
831 B
Arduino
|
const int Pin[12] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,13};
|
||
|
const int Pot[12] = {A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11};
|
||
|
int value[12];
|
||
|
const int funcion = 48;
|
||
|
|
||
|
void setup() {
|
||
|
// set pins 2 through 13 as outputs:
|
||
|
Serial.begin(57600);
|
||
|
for(int i=0; i<12; i++) pinMode(Pin[i], OUTPUT);
|
||
|
pinMode(funcion, INPUT);
|
||
|
digitalWrite(funcion, HIGH);
|
||
|
}
|
||
|
|
||
|
void loop()
|
||
|
{
|
||
|
if (digitalRead(funcion))
|
||
|
{
|
||
|
Serial.println("Independiente");
|
||
|
for(int i=0; i<12; i++)
|
||
|
{
|
||
|
value[i] = map(analogRead(Pot[i]),0,1023,0,255);
|
||
|
analogWrite(Pin[i], value[i]);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Serial.println("Grupo");
|
||
|
value[0] = map(analogRead(Pot[0]),0,1023,0,255);
|
||
|
for(int i=0; i<12; i++) analogWrite(Pin[i], value[0]);
|
||
|
}
|
||
|
|
||
|
}
|