Hola un saludo antes de todo, quiero aclarar que estoy comenzando con la programacion en arduino.
Pues desarrollando este programa me surgio este error, y por mas que trato de buscar la solucion no doy.
int bot []= {1,2,3};
int led[]= {4,5,6,7,8,9,10,11,12,13};
int numbots=3;
int numleds=10;
int tiemporet=400;
int tiemporetociosa=200;
int estepin;
int cuenta_alto=0;
int cuenta_der=0;
int cuenta_izq=0;
int cuenta_ocio;
boolean bot_alto=LOW;
boolean bot_derecha=LOW;
boolean bot_izquierda=LOW;
void setup() {
for(estepin=0; estepin<numbots; estepin++)
{
pinMode(bot[estepin],INPUT);
}
for(estepin=0; estepin<numleds; estepin++)
{
pinMode(led[estepin],OUTPUT);
}
}
void loop() {
for(estepin=0; estepin<numleds; estepin++)
{
digitalWrite (led[estepin],LOW);
}
bot_derecha = digitalRead (bot[0]);
bot_alto = digitalRead (bot[1]);
bot_izquierda = digitalRead (bot[2]);
if (bot_derecha==HIGH)
{
Derecha ();
}
else if (bot_alto==HIGH)
{
Alto ();
}
else if (bot_izquierda==HIGH)
{
Izquierda ();
}
else
{
ociosa ();
}
}
void alto() {
if (cuenta:alto==1)
{
for (estepin=0;estepin<numleds;estepin++)
{
digitalWrite(led[estepin], HIGH);
}
}
else
{
for(estepin=0;estepin<numleds;estepin++)
{
digitalWrite(led[estepin], LOW);
}
}
delay(tiemporet);
cuenta_alto++;
if (cuenta_alto>1)
{
cuenta_alto=0;
}
}
void izquierda() {
switch(cuenta_izq)
{
case 0:
digitalWrite(led[2], HIGH);
digitalWrite(led[9], HIGH);
digitalWrite(led[4], HIGH);
break;
case 1:
digitalWrite(led[1], HIGH);
digitalWrite(led[8], HIGH);
digitalWrite(led[5], HIGH);
break;
case 2:
digitalWrite(led[0], HIGH);
digitalWrite(led[7], HIGH);
digitalWrite(led[6], HIGH);
break;
default:
;// no hay instrucciones a realizar
}
}
delay(tiemporet);
cuenta_izq++;
if (cuenta_izq>3)
{
cuenta_izq=0;
}
}
void derecha ()
{
switch (cuenta_der)
{
case 0:
digitalWrite (led[0],HIGH);
digitalWrite (led[8],HIGH);
digitalWrite (led[6],HIGH);
break;
case 1:
digitalWrite (led[1],HIGH);
digitalWrite (led[9],HIGH);
digitalWrite (led[5],HIGH);
break;
case 2:
digitalWrite (led[2],HIGH);
digitalWrite (led[3],HIGH);
digitalWrite (led[4],HIGH);
break;
default:
;
}
delay (tiempoRet);
cuenta_der++;
if (cuenta_der > 3)
{
cuenta_der = 0;
}
}
void ociosa ()
{
digitalWrite (led[cuenta_ocio],HIGH);
digitalWrite (led[cuenta_ocio+4],HIGH);
delay (tiemporetociosa);
digitalWrite(led[cuenta_ocio],LOW);
digitalWrite(led[cuenta_ocio],LOW);
cuenta_ocio++;
if (cuenta_ocio>3)
{
cuenta_ocio=0;
}
}
El error que manda es ¨derecha¨ was not declared in this scope
Espero algunos consejos de que puede ser, ya lo puse como int derecha pero sale otro error mas adelante en
derecha () ;
Con la mismo error, gracias espero su ayuda.