I'm using the tiny45 for a project where I have to read two ADC's and control an LED and a servo. I'm using the Servo8Bit library and configured the ATtiny at 8MHz internal.
The first ADC value controls the LED brightness and the second ADC value is compared with a threshold to decide whether to actuate the servo (angle is predetermined).
When I tested this on the Arduino MEGA board using the standard Servo.h library, everything worked fine.
Even on the ATtiny, the ADC's and PWM's work perfectly when I read the analog inputs and output the same voltage on the PWM pins. But everything stops working when i #include the "Servo8Bit.h". Even the LED stops glowing and servo is dead.
Just using the preprocessor directive renders the tiny45 dead. And comes back alive when I remove it.
Is that library specifically meant for the tiny x5 series? The timers available on the x5 are significantly different from those available on other attiny boards.
Also - whenever you use any servo library, it's going to take out some of the PWM outputs (1 or 2 on the x5 series, depending on whether it uses timer0 (which will also take out millis() ) or timer1 (which is totally unlike timer1 on any other AVR micro other than the tiny x61 series)
Thanks for the reply..
I am not using the PWM's simultaneously so had ruled that out. I detach the Servo as soon as it's scope is out, on every iteration of void loop.
So I think it's the compatibility issue as you've said. Can you suggest a good servo library for the 45? With the detach function operational?
I was going through the forum for similar topics and found a couple of libraries for the tiny45, so I downloaded them and tested. One of them, Servo8Bit2 seems to work. No problems till now.