Go Down

Topic: ATTINY85 20PU Arduino Error (Read 1 time) previous topic - next topic


hello everyone
so i just bought couple ATTINY85 20PU i want to try the servo knob example to use for my telescope eye focus and don't want to carry my ardino board around when i go out to star gaze, so i got the attiny85 to program the example sketch to the chip but i keep getting an error, i can upload the blink sketch that is used on sites and videos on programming the attiny85 and it works, but when i try to use the servo knob sketch and change the pins for the servo signal and the pot signal to 2 pins the chip has i keep getting an error and even when i just leave the pin setting the same i get the same error, im still a newbie to the whole arduino and programming thing so most stuff i do is stuff that people have posted up online,i've set my board to ATtiny85 (w/ arduino as ISP) port is set to 3 and is checked, i've uploaded the ArduinoISP sketch to my arduino mega 2560 with no probs i've connected 3 leds to show if there is a prob and i have green led set to show heart pulse to show the programmer is running and thats what it does, i've included a screenshot of the error, and also i have a couple 1218 ATMEGA328P-PU Arduino UNO Bootloader how or can i use my Arduino Mega 2560 with this chip to program and if so how would i connect it to my board, i only have the mega 2560, no other programmers just that board with circuit chips and a breadboard, any help would be very great full thanks

Tom Carpenter

You would need to modify the Servo library to support the tiny85 (or find someone who has a modified version). The timers are different between the two which is why you get strange error messages about missing register definitions.


ok cool thanks  8)
how would i do that or what would need to be changed in the servo library? like said im still a newb to the whole arduino thing. thanks


This library is made for the Attiny85



Kool thank you, now my prob is i i get this error, i copied the servo8bit files to the servo library folder and changed the #include <servo.h> to <servo8bit.h> and i changed the potpin = 0; to 2 and servo from 9 to 0

sketch_oct23a.cpp:4:24: error: Servo8bit.h: No such file or directory
sketch_oct23a:5: error: 'Servo' does not name a type
sketch_oct23a.cpp: In function 'void setup()':
sketch_oct23a:12: error: 'myservo' was not declared in this scope
sketch_oct23a.cpp: In function 'void loop()':
sketch_oct23a:19: error: 'myservo' was not declared in this scope

Tom Carpenter

You should change:
Code: [Select]
Servo myServo;
Code: [Select]
Servo8Bit myServo;


sketch_oct23a.cpp:4:24: error: Servo8bit.h: No such file or directory

Either you have not placed the library in the right place, or you didn't restart the IDE after the installation


i've tried that and now i get this error, Sorry i'me a newb, and very greatful for the help from everyone, this is the error below with sketch
the 8bit servo file that i download is in arduino-0022/libraries/servo
with the download there is these files
an i have closed the program and unhooked the board and reconnected it and opend arduino and opened file/examples/servo/knob.
i noticed that when i add 8bit to Servo myservo; the Servo thats in orange changed to black when i add 8bit

here is the sketch that i used

// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

#include <Servo8bit.h>

Servo8bit myservo;  // create servo object to control a servo

int potpin = 2;  // analog pin 2 used to connect the potentiometer
int val;    // variable to read the value from the analog pin

void setup()
 myservo.attach(0);  // attaches the servo on pin 0 to the servo object

void loop()
 val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
 val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
 myservo.write(val);                  // sets the servo position according to the scaled value
 delay(15);                           // waits for the servo to get there

error that i get

Knob.cpp:4:24: error: Servo8bit.h: No such file or directory
Knob:5: error: 'Servo8bit' does not name a type
Knob.cpp: In function 'void setup()':
Knob:12: error: 'myservo' was not declared in this scope
Knob.cpp: In function 'void loop()':
Knob:19: error: 'myservo' was not declared in this scope


Ok, try this

Make a folder under libraries called Servo8Bit

in this folder you copy the two files Servo8Bit.cpp and Servo8Bit.h

in the start of your sketch you write

#include <Servo8Bit.h>

And note capital B and S


Hay yaaaa  :smiley-yell:, that worked thanks everyone, rock on, the only error i get now is

Binary sketch size: 1902 bytes (of a 8192 byte maximum)
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

but was told in videos on youtube that error is ok

Thanks everyone.

Tom Carpenter

Yeah, that error is for Parallel programmers only, so you can ignore it.

Just to avoid confusion later, you should follow the instructions here:

Basically there is a bug in the GCC version distributed with Arduino which causes cryptic error messages if the compiled size for an attiny85 (or 84) is larger than 4kB. The link explains the simple fix for it.

Go Up