Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int pot = A0;
- const int alm = A1;
- const int cho = A2;
- const int cip = A3;
- int s1 = 0;
- int s2 = 0;
- int s3 = 0;
- int s4 = 0;
- #include <Servo.h>
- Servo potorro;
- Servo almeja;
- Servo chocho;
- Servo cipote;
- void setup() {
- Serial.begin(9600);
- potorro.attach(9);
- almeja.attach(10);
- chocho.attach(11);
- cipote.attach(6);
- }
- void loop() {
- s4 = analogRead(alm);
- Serial.print("cip = ");
- Serial.println(s4);
- if (s4<400)
- {
- cipote.write(2);
- }
- else{
- cipote.write(60);
- }
- //----------------------------
- s3 = analogRead(alm);
- Serial.print("cho = ");
- Serial.println(s3);
- if (s2<400)
- {
- chocho.write(2);
- }
- else{
- chocho.write(60);
- }
- //-----------------------------
- s2 = analogRead(alm);
- Serial.print("alm = ");
- Serial.println(s2);
- if (s2<400)
- {
- almeja.write(2);
- }
- else{
- almeja.write(60);
- }
- //-----------------------------
- s1 = analogRead(pot);
- Serial.print("pot = ");
- Serial.println(s1);
- if (s1<400)
- {
- potorro.write(2);
- }
- else{
- potorro.write(60);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement