ATTiny85 tone() core?

Hi Ugi

I just ran the test sketch below using tone on D3 then D4 and both results were equivalent. tone() works on PB3 and PB4 based on my tests. I used an 8Ohm speaker and two different piezos for the tests (they sounded terrible in contrast - I'll stick to speakers for this kind of thing I think !)

const int testPin = 3;

void setup() {
  pinMode(testPin, OUTPUT);                    
}

void loop() {
  for(int val = 30; val < 3000; val++) {
  tone(testPin, val);
  delay(5);
  }
    for(int val = 3000; val >30; val--) {
  tone(testPin, val);
  delay(5);
  }
  noTone(testPin);
}

So while that worked, analogWrite() on PB3/D3 actually didn't which agrees with your findings. It was a hard flash rather than the pulse I'd intended so acted as a digitalWrite. I'm certain analogWrite() has worked for me in the past on PB3 but when I went back through past sketches I've not kept a sketch that used it. Not at all certain on that one now.

Anyway I can confirm tone() works with the above sketch, so if it doesn't for you I'd be looking elsewhere. I tested on an ATTiny85 running at 8MHz off a CR2032 3V cell - the only other component on my test rig is a 0.1uF decoupling cap.

Cheers ! Geoff