I have tried the blink, fade and potmeter sketches with nio problem, and now I would try a servo sketch using the SoftwareServo. But it only works partly, I can move the servo either by using a potmeter, or by coding with fixed values as below, but either way the servo jitters, it is moving like it should but it jitters.
My guess is that the pwm freqense is wrong, it should be 50HZ, but as far as I know on the Arduino Uno it is about 400HZ, and the servo runs smooth anyway.
I am not using a external x-tal, and I don't have an oscilloscop to measure the frequence
(I don't know how to hit the # , where and when should I do it)
Any suggestions.
#include <SoftwareServo.h>
SoftwareServo servo;
int potpin = 3;
int val;
long previousMillis = 0; // will store last time LED was updated
long interval = 100; // interval at which to blink (milliseconds)
void setup()
{
pinMode(1, OUTPUT);
pinMode(3, INPUT);
servo.attach(1);
}
void loop()
{
unsigned long currentMillis = millis();
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)
if(currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
servo.write(val); // sets the servo position according to the scaled value
SoftwareServo::refresh();
} //if
} //loop
But then I get this error message in the Arduino IDE
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
I know I don't know enough about programming fuses just yet, so maybe I will wait till I get older and Wiser XD
Coding Badly
Sorry wasn't clear, what I meant was: when I copy a sketch from the IDE to the forum I use Edit->Copy for forum
I know there is a better way involving the # sign, but I dont't know where I am supposed to use it
editing the board.txt file is not enough to make the tiny run faster.
if you are going to play with other mcu than the atmega328, you have to know how the fuses systm work.
anyway, the board.txt file was correct to deal with virgin attiny85 as the have a native 1mhz clock, so don't alter it.
You can use software servo library http://www.arduino.cc/playground/ComponentLib/Servo
...are mutually exclusive. You can use SoftwareServo --OR-- you can use delay but you cannot use both. You will have to use the BlinkWithoutDelay technique...
I have installed your core. First I tried with som small sketches like blink and fade, that worked fine, no problem
Then I tried to change the clock freq. to 8 MHz using your procedure (burning bootloader):
Doing so gives me the following error:
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
avr_read(): error reading address 0x0000
read operation not supported for memory "lock"
avrdude: failed to read all of lock memory, rc=-2
I have read elsewere that In can ignore the first 2 lines (I got the same error using the HLT core)
But the last 3 lines I don't understand. A wild guess: Does it only work with a virgin Chip? or is something else wrong.
I bought a very old (and very cheap) oscilloscop and as far as I can read it the PWM signal is high for 1 second and low for 1 sek, at 50% dutycycle, so that seems to indicate that I am right assuming that the servo jitter is due to a wong PWM freq. (the PWM signal should be between 1 and 2 ms)
Another rather funny observation: If I just use the attiny 8 mhz option when uploading a sketch it just slows the freq. down, f.ex the blink example gets maybe 8 ? times slower.
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
I have read elsewere that In can ignore the first 2 lines (I got the same error using the HLT core)
Yes. You can ignore the PAGEL / BS2 warnings.
avr_read(): error reading address 0x0000
read operation not supported for memory "lock"
avrdude: failed to read all of lock memory, rc=-2
But the last 3 lines I don't understand. A wild guess: Does it only work with a virgin Chip? or is something else wrong.
The avrdude.conf needs a small modification. Give these a read...