Hola.
Necesito ayuda con algo no tengo un arduino Omega 2650 necesito controlar un panel de 16 reles pero solo puedo logar controlar 10.
Les dejo mi programación adjunta. E notado el el case esta el problema pero solo puedo ir de 0-9 como puedo llegar a mas de 9?
////////////////////////////////////////////////////////////////////////
// Para comprobar la función de cliente
////////////////////////////////////////////////////////////////////////
//
void checkForClient() {
EthernetClient client = server.available();
if (client) {
// Una petición http termina con una línea en blanco
boolean currentLineIsBlank = true;
boolean sentHeader = false;
while (client.connected()) {
if (client.available()) {
//if header was not set send it
//read user input
char c = client.read();
if (c == '*') {
printHtmlHeader(client); // Llamar para la cabecera HTML y CSS
printLoginTitle(client);
printHtmlFooter(client);
//sentHeader = true;
break;
}
if (!sentHeader) {
printHtmlHeader(client); // Llamar para la cabecera HTML y CSS
printHtmlButtonTitle(client); // Imprimir el título del botón
// Esto es para el Arduino para construir la página sobre la marcha.
sentHeader = true;
}
//read user input
// char c = client.read();
// Si había la lectura, pero está en blanco no hubo lectura
if (reading && c == ' ') {
reading = false;
}
//si hay un ? no había entrada de usuario
if (c == '?') {
reading = true; // Encontrado el?, Comenzará la lectura de la información
}
// if there was user input switch the relevant output
if (reading) {
//if user input is H set output to 1
if (c == 'H') {
outp = 1;
}
//if user input is L set output to 0
if (c == 'L') {
outp = 0;
}
Serial.print(c); //print the value of c to serial communication
//Serial.print(outp);
//Serial.print('\n');
switch (c) {
case '0':
//add code here to trigger on 0
triggerPin(outputAddress[0], client, outp);
break;
case '1':
//add code here to trigger on 1
triggerPin(outputAddress[1], client, outp);
break;
case '2':
//add code here to trigger on 2
triggerPin(outputAddress[2], client, outp);
break;
case '3':
//add code here to trigger on 3
triggerPin(outputAddress[3], client, outp);
break;
case '4':
//add code here to trigger on 4
triggerPin(outputAddress[4], client, outp);
break;
case '5':
//add code here to trigger on 5
triggerPin(outputAddress[5], client, outp);
//printHtml(client);
break;
case '6':
//add code here to trigger on 6
triggerPin(outputAddress[6], client, outp);
break;
case '7':
//add code here to trigger on 7
triggerPin(outputAddress[7], client, outp);
break;
case '8':
//add code here to trigger on 8
triggerPin(outputAddress[8], client, outp);
break;
case '9':
//add code here to trigger on 9
triggerPin(outputAddress[9], client, outp);
break;
} // Fin de la caja de conmutación
}// Fin de cambiar la salida de interruptor correspondiente
//if user input was blank
if (c == '\n' && currentLineIsBlank) {
printLastCommandOnce = true;
printButtonMenuOnce = true;
triggerPin(777, client, outp); // Llamar para leer el menú de entrada y de impresión. 777 se utiliza no para actualizar las salidas
break;
}
}
}
printHtmlFooter(client); // Imprime el pie de página html
}
else
{ //if there is no client
// Y el tiempo de la última página se sirve es más de un minuto.
if (millis() > (timeConnectedAt + 60000)) {
if (writeToEeprom == true) {
writeEepromValues(); // Escritura en la EEPROM los estados de salida actuales
Serial.println("No Clients for more then a minute - Writing statuses to Eeprom.");
writeToEeprom = false;
}
}
}
}
////////////////////////////////////////////////////////////////////////
//triggerPin Function
// Función Pin gatillo
////////////////////////////////////////////////////////////////////////
//
void triggerPin(int pin, EthernetClient client, int outp) {
// Conexión o desconexión de las salidas, lee las salidas e imprime los botones
// Configuración de Salidas
if (pin != 777) {
if (outp == 1) {
if (outputInverted == false) {
digitalWrite(pin, HIGH);
}
else {
digitalWrite(pin, LOW);
}
}
if (outp == 0) {
if (outputInverted == false) {
digitalWrite(pin, LOW);
}
else {
digitalWrite(pin, HIGH);
}
}
}
// Actualiza la lectura de los resultados
readOutputStatuses();
// Imprime los botones
if (printButtonMenuOnce == true) {
printHtmlButtons(client);
printButtonMenuOnce = false;
}
}