softrcpulseout libuary // Turret code for the Digispark / Attiny85 microcontroller //This code is based on the example "Sweep" from SoftRcPulseOut library, modify at will! #include SoftRcPulseOut myservo; #define SERVO_PIN 0 // assigns signal pin for servo (pin 0) #define NOW 1 int spd = 40; // time between each degree of angle, higher time means slower speed int i = 0; softrcpulseout libuary PasteShr softrcpulseout libuary int k = 0; int ang = 90; void setup() { myservo.attach(SERVO_PIN); // attaches the servo on pin defined by SERVO_PIN to the servo object myservo.write(ang); delay(1000); softrcpulseout libuary How to use it? softrcpulseout libuary SoftRcPulseOut::refresh(NOW); // ang = 45; } void loop() { for(i = 0; i < 90; i++) //sweeps to one side 90 degrees { myservo.write(ang+i); softrcpulseout libuary How to dowload it? softrcpulseout libuary delay(spd); SoftRcPulseOut::refresh(NOW); } delay(1000); for(k = 89; k>-1; k--) //sweeps to the other side 90 degrees { myservo.write(ang+k); delay(spd); SoftRcPulseOut::refresh(NOW); softrcpulseout libuary How to use it? softrcpulseout libuary } delay(1000); } softrcpulseout libuary