Revisions
-
nouyang revised this gist
Oct 15, 2013 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Servo servo1; Servo servo2; float theta1; float theta2; int pot1 = 0; int pot2 = 1; @@ -13,7 +13,6 @@ void setup() { servo2.attach(3,750,2200); servo1.write(90); servo2.write(90); } void loop() { -
nouyang revised this gist
Oct 15, 2013 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,13 +4,11 @@ Servo servo1; Servo servo2; float theta1; // target angles as determined through IK float theta2; int pot1 = 0; int pot2 = 1; void setup() { // Serial.begin(9600); servo1.attach(2,750,2200); servo2.attach(3,750,2200); servo1.write(90); @@ -21,7 +19,7 @@ void setup() { void loop() { theta1 = analogRead(pot1); theta2 = analogRead(pot2); // Serial.print(theta1); Serial.print(","); Serial.println(theta2); theta1 = -(theta1/1023)*220+200; theta2 = -(theta2/1023)*220+200; if(theta1 < 0) theta1 = 0; -
nouyang revised this gist
Oct 11, 2013 . 1 changed file with 0 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,26 +2,19 @@ Servo servo1; Servo servo2; float theta1; // target angles as determined through IK float theta2; int theta1prev; //old targets for error correction int theta2prev; int pot1 = 0; int pot2 = 1; void setup() { Serial.begin(9600); servo1.attach(2,750,2200); servo2.attach(3,750,2200); servo1.write(90); servo2.write(90); pinMode(13,OUTPUT); } -
nouyang renamed this gist
Oct 11, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nouyang revised this gist
Oct 11, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ #include <Servo.h> Servo servo1; Servo servo2; Servo servo3; -
nouyang created this gist
Oct 11, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ #include <Servo.h> Servo servo1; Servo servo2; Servo servo3; float theta1; // target angles as determined through IK float theta2; int theta1prev; //old targets for error correction int theta2prev; int buf; int pot1 = 0; int pot2 = 1; unsigned long time; //time is really long! int writingposition = 140; int idleposition = 170; void setup() { Serial.begin(9600); servo1.attach(2,750,2200); servo2.attach(3,750,2200); //servo3.attach(2,500,2400); servo1.write(90); servo2.write(90); //servo3.write(idleposition); pinMode(13,OUTPUT); } void loop() { theta1 = analogRead(pot1); theta2 = analogRead(pot2); // Serial.print(theta1); Serial.print(","); Serial.println(theta2); theta1 = -(theta1/1023)*220+200; theta2 = -(theta2/1023)*220+200; if(theta1 < 0) theta1 = 0; if(theta2 < 0) theta2 = 0; if(theta1 > 180) theta1 = 180; if(theta2 > 180) theta2 = 180; drive_joints(); } /* drive_joints() simply moves servos 1 and 2 */ void drive_joints() { servo1.write(theta1); servo2.write(theta2); delay(30); }