Paso 12: Codificación y programación Arduino
Mi código:
int i = 13;
corazón de int = 11; PWM pin
int te = 12;
becca int = 10; PWM
dan int = 9; PWM
int y = 8;
modea int = 1;
modeb int = 2;
void setup()
{
pinMode (i, salida);
pinMode (corazón, salida);
pinMode (, salida);
pinMode (becca, salida);
pinMode (dan, salida);
pinMode (plus, salida);
pinMode (modea, entrada);
pinMode (modeb, entrada);
}
void loop()
{
int x = digitalRead(modea);
int y = digitalRead(modeb);
Si (x == HIGH)
{
digitalWrite (i, alto);
Delay(1000);
digitalWrite (i, LOW);
digitalWrite (corazón, alta);
Delay(1000);
digitalWrite (corazón, LOW);
digitalWrite (usted, alto);
Delay(1000);
digitalWrite (usted, LOW);
Delay(100);
digitalWrite (i, alto);
digitalWrite (corazón, alta);
digitalWrite (usted, alto);
Delay(1000);
digitalWrite (i, LOW);
digitalWrite (corazón, LOW);
digitalWrite (usted, LOW);
Delay(100);
}
Si (x == LOW)
{
digitalWrite (i, LOW);
digitalWrite (corazón, LOW);
digitalWrite (usted, LOW);
}
Si (y == HIGH)
{
digitalWrite (becca, HIGH);
Delay(1000);
digitalWrite (becca, LOW);
digitalWrite (plus, alta);
Delay(1000);
digitalWrite (plus, LOW);
digitalWrite (dan, HIGH);
Delay(1000);
digitalWrite (dan, LOW);
Delay(100);
digitalWrite (becca, HIGH);
digitalWrite (plus, alta);
digitalWrite (dan, HIGH);
digitalWrite (corazón, alta);
Delay(1000);
digitalWrite (becca, LOW);
digitalWrite (plus, LOW);
digitalWrite (dan, LOW);
digitalWrite (corazón, LOW);
Delay(100);
}
Si (y == LOW)
{
digitalWrite (corazón, LOW);
digitalWrite (becca, LOW);
digitalWrite (dan, LOW);
digitalWrite (plus, LOW);
}
Si (x == baja & & y == LOW)
{
digitalWrite (i, alto);
digitalWrite (corazón, alta);
digitalWrite (usted, alto);
Delay(5000);
digitalWrite (i, LOW);
digitalWrite (usted, LOW);
digitalWrite (becca, HIGH);
digitalWrite (plus, alta);
digitalWrite (dan, HIGH);
Delay(5000);
digitalWrite (becca, LOW);
digitalWrite (dan, LOW);
digitalWrite (plus, LOW);
}
}