/*
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;
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(PB0);
}
long int lastUpdate = 0;
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
myservo.refresh(); // refresh the position of the servo
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
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