Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <InputDebounce.h>
- #include <Bounce2.h>
- #include <Servo.h>
- int buttonA = 51;
- int buttonB = 52;
- int buttonC = 53;
- int buttonD = 30;
- int buttonE = 41;
- int rele2 = 27;
- int rele3 = 28;
- int rele4 = 29;
- int rele1 = 26;
- int tempo = 10;
- int lettura = analogRead(A0);
- Servo myservo;
- void setup()
- {
- myservo.attach(31);
- Serial.begin(9600);
- pinMode(buttonA, INPUT);
- pinMode(buttonB, INPUT);
- pinMode(buttonC, INPUT);
- pinMode(buttonD, INPUT);
- pinMode(buttonE, INPUT);
- pinMode(rele2, OUTPUT);
- pinMode(rele3, OUTPUT);
- pinMode(rele4, OUTPUT);
- pinMode(rele1, OUTPUT);
- }
- void loop()
- {
- Serial.println();
- int alpha=LOW;
- int beta=LOW;
- int gamma=LOW;
- int soglia=250;
- int memoria;
- int bevanda;
- digitalWrite(rele1, HIGH);
- digitalWrite(rele4, HIGH);
- digitalWrite(rele3, HIGH);
- digitalWrite(rele2, HIGH);
- if(digitalRead(buttonA)==HIGH)
- {
- alpha=HIGH;
- }
- if(digitalRead(buttonB)==HIGH)
- {
- beta=HIGH;
- }
- if(digitalRead(buttonC)==HIGH)
- {
- gamma=HIGH;
- }
- while(memoria==HIGH)
- {
- if(alpha==HIGH)
- {
- digitalWrite(rele1, HIGH);
- digitalWrite(rele2, HIGH);
- }
- if(beta==HIGH)
- {
- digitalWrite(rele1, HIGH);
- digitalWrite(rele3, HIGH);
- }
- if(gamma==HIGH)
- {
- digitalWrite(rele1, HIGH);
- digitalWrite(rele4, HIGH);
- }
- if(lettura < soglia)
- {
- memoria=HIGH;
- }
- else {memoria=LOW;}
- if(memoria==LOW){break;}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement