/**
TinyDebug usage example: ATtiny85 debug prints in the Wokwi Simulator.
*/
#include "TinyDebug.h"
#include "Servo_ATTinyCore.h"
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
#define LED 2
void setup() {
Debug.begin();
Debug.println(F("Hello Tiny!"));
pinMode(LED, OUTPUT);
myservo.attach(1); // attaches the servo on pin 9 to the servo object
}
int i = 0;
void loop() {
delay(500);
i++;
Debug.print(F("Counter: "));
Debug.println(i);
digitalWrite(LED, !digitalRead(LED));
//for (int pos = 0; pos <= 90; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(90); // tell servo to go to position in variable 'pos'
delay(3000); // waits 15ms for the servo to reach the position
// }
//for (int pos = 90; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(0); // tell servo to go to position in variable 'pos'
delay(3000); // waits 15ms for the servo to reach the position
//}
}