Helicopter/Howard Community College/adsasf/550 code
int servoPin = 9; int myAngle; int pulseWidth;
void setup() {
pinMode(9, OUTPUT);
}
void servoPulse(int servoPin, int myAngle) {
pulseWidth = (myAngle * 6) + 320; digitalWrite(servoPin, HIGH); delayMicroseconds(pulseWidth); digitalWrite(servoPin, LOW); delay(20);
void loop()
{
for (myAngle=0; myAngle<=180; myAngle++) { servoPulse(servoPin, myAngle); delay(100); servoPulse(servoPin, myAngle); delay(100); servoPulse(servoPin, myAngle); delay(100); servoPulse(servoPin, myAngle); delay(100); servoPulse(servoPin, 90); delay(100); servoPulse(servoPin, 90); delay(100); servoPulse(servoPin, 90); delay(100); servoPulse(servoPin, 90); delay(100); } delay(1000);
}