/*
Sweep adapter for the ATtiny85, using the AdaFruit SoftServo library.
Servo is connected to pin PB0.
Example created especially for Blake Madison
*/
#include <Adafruit_SoftServo.h> // SoftwareServo (works on non PWM pins)
Adafruit_SoftServo myservo;
byte position = 0; // variable to store the servo position
void setup() {
myservo.attach(PB0);
}
void loop() {
for (position = 0; position <= 180; position += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(position); // tell servo to go to position in variable 'position'
myservo.refresh(); // refresh the position of the servo
delay(20); // waits 20ms for the servo to reach the position
}
for (position = 180; position >= 0; position -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(position); // tell servo to go to position in variable 'position'
myservo.refresh(); // refresh the position of the servo
delay(15); // waits 15ms for the servo to reach the position
}
}
// Note: you can also use a timer to automatically refresh the position of the servo for you.
// For example, check this out: https://github.com/adafruit/Adafruit_SoftServo/blob/master/examples/TrinketKnob/TrinketKnob.ino