Go Down

Topic: Getting Libraries on ATTiny45 (Read 59 times) previous topic - next topic

Michijg

Mar 19, 2017, 10:35 pm Last Edit: Mar 19, 2017, 10:41 pm by Michijg
Hello,
I recently wanted to finish a project for my school class by putting it on an ATTiny45 via the Arduino as an ISP like it's described here:highlowtech.org/?p=1706
The code is pretty simple. Essentially after you push a button the servo moves 180 degrees and back. My problem now is that I get error-messages if I want to compile the sketch for the ATTiny. As far as I understood, the library isn't compatible with the chip or am i wrong?
Is there any solution to get the code on the chip another way?

Code: [Select]

#include <Servo.h>

Servo myservo;

void setup() {
  myservo.attach(2);
  myservo.write(0);
  pinMode(1, INPUT);
}


void loop() {
  if (digitalRead(1) == HIGH)
  {
    myservo.write(180);
    delay(500);
  }

  if (digitalRead(1) == LOW)
  {
    myservo.write(5);
    delay(150);
  }
}


ty_ger07

#1
Mar 19, 2017, 11:32 pm Last Edit: Mar 19, 2017, 11:37 pm by ty_ger07
Quote
My problem now is that I get error-messages if I want to compile the sketch for the ATTiny. As far as I understood, the library isn't compatible with the chip or am i wrong?
Well, I don't know.  I think that you are wrong.  But, I don't see that you posted the error message in your post. Or am I wrong? ;)  Where is the error message which we are supposed to be judging in relation to or commenting on?

DrAzzy

Standard servo library is incompatible with the tiny x5 - it doesn't have a 16-bit timer1, instead it has an 8-bit high-speed timer (can be clocked off internal PLL at 64mhz if you configure it for that, allowing higher frequency PWM than most AVR microcontrollers)
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy