I suspect it has something to do with the PWM frequency being different from the Arduino itself, because when I run the same servo program on my Uno, it works fine. But, as the title says, on my ATtiny, it will start at 0 and only go to about 45. It will keep sending a signal, however, and my servo gets hot.
I'm running it at 8mhz, I have my output on one of the chip's PWM pins, and I'm using the SoftwareServo library.
Any help here? Apologies if this is the wrong category. I can send code and pictures if necessary.
I don't have ATtiny84. I have executed the following sketch using DigisprakATtiny85 Board (Fig-1, 2), and the SG-90 Servo Motor turns from 00 to 1800 (Fig-3).
#include <Servo_ATTinyCore.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(1); // PB1
}
void loop()
{
for (pos = 0; pos <= 180; pos += 1)
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1)
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
Yes, I've tried it with SoftwareServo and the default library that comes installed with the IDE, they both produce the same result. But yes, I'm using ATTinyCore.
Here's the code:
#include <Servo.h>
Servo myservo;
void setup() {
myservo.attach(A6);
}
void loop() {
for (int i = 0; i < 180; i++) {
myservo.write(i);
delay(15);
}
}