Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- Servo myservo,m2,m3,m4;
- int pos = 0,pos2=0,pos3=0,pos4=0;
- int pot=A0,pot2=A1,pot3=A2,pot4=A3;
- int potDeger2,potDeger,potDeger3,potDeger4;
- void setup() {
- myservo.attach(8);
- m2.attach(9);
- m3.attach(10);
- m4.attach(11);
- myservo.write(0);
- m2.write(0);
- m3.write(0);
- m4.write(0);
- Serial.begin(9600);
- }
- void loop() {
- potDeger=analogRead(pot);
- potDeger=map(potDeger, 0, 1023, 0, 180);
- Serial.println(potDeger);
- myservo.write(potDeger);
- //İleri Geri
- potDeger2=analogRead(pot2);
- potDeger2=map(potDeger2, 0, 1023, 0, 180);
- Serial.println(potDeger2);
- m2.write(potDeger2);
- //Yan
- potDeger3=analogRead(pot3);
- potDeger3=map(potDeger3, 0, 1023, 0, 180);
- Serial.println(potDeger3);
- m3.write(potDeger3);
- //Griper
- potDeger4=analogRead(pot4);
- potDeger4=map(potDeger4, 0, 1023, 0, 180);
- Serial.println(potDeger4);
- m4.write(potDeger4);
- //AsagiYukari
- }
Add Comment
Please, Sign In to add comment