// 2009 mlab.uiah.fi/paja // Extending Arduiino using library // Controlling servo motor /* To install a library, unzip the library and copy it to following location. Arduino.app > Contents > Resources > Java > hardware > libraries. Restart the Arduino. Yoshould see the library in the Import Library menu. */ #include Servo myServo; int flexiPin = 0; int valueInt; void setup(){ Serial.begin(9600); // Servo motor works only pin 9 and 10 on Arduiono NG myServo.attach(9); } void loop(){ valueInt = analogRead(flexiPin); // Map minimum analog and maximum values to angle 0 to 179. valueInt = map(valueInt, 30, 300, 0, 179); // send value to the servo motor myServo.write(valueInt); valueInt = myServo.read(); Serial.println(valueInt); delay(10); }