hi guys
i'm busy with a small project.
last week i made a simple pcb to change/map pwm values.
got the code running on an atmage 328 and works flaweless
now i wanted to shrink the project down to a single chip. an attiny85
i use my uno as an isp.
connected the attiny and test uploaded the blink sketch. everything works fine and the led blinks (running at 1mhz)
But when i want to upload the same sketch i uploaded to the atmega328, i get an error message:
Error compiling for board ATtiny.
already changed the pin ports to 0 and 1.
Pin 0 must be reading the pwm values and pin 1 should output the values.
what am i missing?
Here is the code:
#include <Servo.h>
Servo myservo;
byte PWM_PIN = 0;
int pwm_value;
void setup() {
pinMode(PWM_PIN, INPUT);
myservo.attach(1);
}
void loop() {
pwm_value = pulseIn(PWM_PIN, HIGH);
pwm_value = map(pwm_value, 1000, 2000, 1450, 1800);
myservo.write(pwm_value);
}
im using arduino IDE 1.6.8.
i have seen more people use servos in an attiny85.
i run on 8 mhz internal clock.
C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp: In function 'void __vector_3()':
C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp:82:44: error: cannot convert 'volatile uint8_t* {aka volatile unsigned char*}' to 'volatile uint16_t* {aka volatile unsigned int*}' for argument '2' to 'void handle_interrupts(timer16_Sequence_t, volatile uint16_t*, volatile uint16_t*)'
handle_interrupts(_timer1, &TCNT1, &OCR1A);
^
C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp: In function 'void initISR(timer16_Sequence_t)':
C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp:129:5: error: 'TCCR1B' was not declared in this scope
TCCR1B = _BV(CS11); // set prescaler of 8
^
C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp:136:5: error: 'TIFR1' was not declared in this scope
TIFR1 |= _BV(OCF1A); // clear any pending interrupts;
^
C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp:137:5: error: 'TIMSK1' was not declared in this scope
TIMSK1 |= _BV(OCIE1A) ; // enable the output compare interrupt
^
exit status 1
Error compiling for board ATtiny.