User Tools

Site Tools


servo-interactive-test

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
servo-interactive-test [2012/10/06 14:16]
85.218.109.130 created
servo-interactive-test [2012/10/11 12:30] (current)
46.57.95.208
Line 2: Line 2:
  
 <code java> <code java>
-// Controlling a servo position using a potentiometer (variable resistor)  +// Controlling a servo position using serial input
-// by Michal Rinott <​http://​people.interaction-ivrea.it/​m.rinott> ​+
  
 #include <​Servo.h> ​ #include <​Servo.h> ​
Line 36: Line 35:
         }         }
   }   }
-//else { +
-// for (val=0; val<179; val++) { +
-//   ​myservo.write(val); ​                 // sets the servo position according to the scaled value  +
-//   ​delay(5); ​                           // waits for the servo to get there +
-// }    +
-// for (val=179; val>0; val--) { +
-//   ​myservo.write(val);​ +
-//   ​delay(5);​ +
-//   } +
-//  }+
  ​} ​  ​} ​
 +</​code>​
 +
 +then in python:
 +
 +<code python>
 +import serial
 +ser=serial.Serial("/​dev/​ttyACM0",​ 9600)
 +ser.write("​30\n"​)
 </​code>​ </​code>​
servo-interactive-test.1349532978.txt.gz · Last modified: 2012/10/06 14:16 by 85.218.109.130