Sorry about the late reply, had a huge amount of work over the last few days so not much time to play with this unfortunately.
Difficult to say. You haven't provided enough information. Which core did you decide to use? What serial-to-USB converter are you using? How do you have the converter connected?
I used your core, with the ATtiny85 simply connected to the Arduino Uno, connected to the PC via USB.
fadeLight is always a negative int value bounded to zero.
That was the problem! I changed fadeLight to 255 instead of 0 in the then-clause of:
if (soundLevel >= threshold)
This fixed the problem entirely, so now my sketch behaves properly on the ATtiny85. A huge
thank you for your invaluable help Coding Badly! Thinking about it now it was actually quite a stupid error on my part, because of course the LED brightness should start at maximum, not zero! I'm quite interested to know why my sketch worked on the Arduino in the first place...
analogWrite does not clamp the value so, when the value changes from -256 to -257 the value actually written to the hardware goes from 0 (full off) to 255 (full on).
Where do the values -256 and -257 come from? I assumed the limit for analogWrite was 255?
There is an assumption that the fading stops at -90 but that may not be true because of the next problem...
Finally, I doubt the application will be running continuously for 49 days but, if it is, it will not work correctly. millis values and addition (and direct comparison) do not mix.
In practice my circuit will run on a battery so it definitely won't be running for 49 days! But from a technical standpoint I'm interested to know what I can do to make the code work indefinitely. What happens after 49 days? Does millis not simply reset to zero?