#include /* Program works by user interacting via the serial monitor Servo commands work by being able to work by sending a PW to the servo on servo PIN User sets up the baud rate to match the command setting Serial is interacted with a PW value and a character string to send, detach, or reattach the connection to the servo */ Servo servo1; Servo servo2; int servo1pin = 14; // PIN 14 is analog PIN 0 on the Arduino Diecimila board int servo2pin = 15; // PIN 15 is analog PIN 1 on the Arduino Diecimila board void setup() { servo1.attach(servo1pin); // Need to review in servo library servo1.setMaximumPulse(2200); // 16-bit integer value is divided by 16 servo2.attach(servo2pin); // Need to review in servo library servo2.setMaximumPulse(2200); // 16-bit integer value is divided by 16 Serial.begin(19200); Serial.print("Ready"); // output to the serial command window } void loop() { static int v=0; if(Serial.available()){ char ch = Serial.read(); Serial.print("\n"); // outputs to screen for read character value Serial.print(ch); Serial.print("\n"); switch(ch) { // evaluate a character string for send, detach, or reattach commands case '0'...'9': v = v*10+ch-'0'; break; case 's': //servo command for sending servo1.write(v); //write to port servo2.write(v); //write to port v=0; break; case 'd': //serial command for detatchment servo1.detach(); servo2.detach(); //write to port break; case 'a': //serial command for attachment servo1.attach(servo1pin); servo2.attach(servo2pin); break; } } Servo::refresh(); // library function }