Code
Project: jvfeatures
jvtypes.h     
jvfeatures.h     
chessSeg.cpp     
jvtypes.cpp     
jvtest.cpp     
jvfeatures.cpp     
Project: Other
migrateMailbox.scpt.txt     
Project: Infinite HMM Tutorial
run.m     
iHMM_tutorial.zip     
HDP_HMM.m     
README.txt     
ConditionalProbabilityTable.m     
HDP.m     
HMMProblem.m     
HMM.m     
Project: RRT
RRT.h     
plot_output.py     
RRT.tgz     
rrt_test.cpp     
RRT.cpp     
BidirectionalRRT.cpp     
AbstractRRT.cpp     
Project: Box2D_friction_mod
WheelConstraint.h     
test_TopDownCar.py     
b2FrictionJoint.h     
python_friction_joint.patch     
test_TopDownFrictionJoint.py     
TestEntries.cpp     
TopDownCar.h     
b2FrictionJoint.cpp     
box2d_friction_joint.patch     
Project: Dirichlet Process Mixture Tutorial
EM_GM.m     
DP_Demo.m     
DPMM.m     
DP_Tutorial.zip     
DirichletProcess.m     
gaussian_EM.m     
Project: Arduino_Code
Arduino_Code.zip     
convert_range2D.py     
arduino-serial.c     
oscilloscope.pde     
motordriver.pde     
helicopter_controller.pde     
accelerometer_test.pde     
ranger_plane_sweep.pde     
clodbuster_controller.pde     
pwm_manual.pde     
ranger_test.pde     
servo_test.pde     
Project: ArduCom
arducom.py     
setup.py     
Project: support
geshi.php     
Protector.php     
Project: Cogent
CodePane.php     
NotesPane.php     
PicsPane.php     
Cogent.php     
PubsTable.php     
Click here to download "resources/code/Arduino_Code/servo_test/servo_test.pde"resources/code/Arduino_Code/servo_test/servo_test.pde
// Sweep
// by BARRAGAN <http://barraganstudio.com>
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int servopin = 6;
char buf[32];
int pos = 0; // variable to store the servo position
void setup()
{
Serial.begin(9600);
myservo.attach(servopin); // attaches the servo on pin 9 to the servo object
}
/* To just loop over the positions 0:180:0 */
//void loop()
//{
// for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
// { // in steps of 1 degree
// sprintf(buf,"setting pos %d",pos);
// Serial.println(buf);
// myservo.write(pos); // tell servo to go to position in variable 'pos'
// delay(15); // waits 15ms for the servo to reach the position
// }
//
// for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
// {
// sprintf(buf,"setting pos %d",pos);
// Serial.println(buf);
// myservo.write(pos); // tell servo to go to position in variable 'pos'
// delay(15); // waits 15ms for the servo to reach the position
// }
//}
/* To set positions manually */
void loop() {
if (Serial.available() > 0) {
int inByte = Serial.read();
switch (inByte) {
case '+':
pos++;
sprintf(buf,"Setting position to %d degrees", pos);
Serial.println(buf);
break;
case '-':
pos--;
sprintf(buf,"Setting position to %d degrees", pos);
Serial.println(buf);
break;
default:
break;
}
}
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}