Pages: [1]   Go Down
Author Topic: ATTINY85 20PU Arduino Error  (Read 1001 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Logged

Leeds, UK
Offline Offline
Edison Member
*
Karma: 80
Posts: 1729
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

~Tom~

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok cool thanks  smiley-cool
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
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 36
Posts: 1084
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This library is made for the Attiny85

http://www.cunningturtle.com/attiny4585-servo-library/
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Leeds, UK
Offline Offline
Edison Member
*
Karma: 80
Posts: 1729
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You should change:
Code:
Servo myServo;
To
Code:
Servo8Bit myServo;
Logged

~Tom~

Denmark
Offline Offline
Edison Member
*
Karma: 36
Posts: 1084
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
example.cpp
Makefile
Readme
Servo8Bit.cpp
Servo8Bit.cpp
 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
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 36
Posts: 1084
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Leeds, UK
Offline Offline
Edison Member
*
Karma: 80
Posts: 1729
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Just to avoid confusion later, you should follow the instructions here:
https://github.com/TCWORLD/ATTinyCore/tree/master/PCREL%20Patch%20for%20GCC

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.
Logged

~Tom~

Pages: [1]   Go Up
Jump to: