Sie sind auf Seite 1von 2

Programacion de arduino

#include <Servo.h>
Servo Puerta; // Crear servo para la Puerta
Servo Chicles; // Crear servo para la Chicles

int buttonPin1 = 13;


int buttonPin2 = 12;
int buttonPin3 = 11;

void setup()
{
Puerta.attach(9);

// Pin 9 para el servo de la Puerta

Chicles.attach(10); // Pin 9 para el servo de la Chicles

pinMode(buttonPin1, INPUT_PULLUP); // PLC Q0.0


pinMode(buttonPin2, INPUT_PULLUP); // PLC Q0.1
pinMode(buttonPin3, INPUT_PULLUP); // PLC Q0.2
}

void loop()
{
if (digitalRead(buttonPin1) == LOW) // Si hay seal, deja caer un chicle
{
Chicles.write(180);
delay(800);
Chicles.write(5);
delay(10);
}

if (digitalRead(buttonPin2) == LOW) // Si hay seal, abre la puerta


{

Puerta.write(180);
delay(10);
}

if (digitalRead(buttonPin3) == LOW) // Si hay seal, cierra la puerta


{
Puerta.write(5);
delay(10);
}
}

Das könnte Ihnen auch gefallen