Having touble getting tone() to sound right on an attiny85 and it cant loop.

I have an attiny85-20pu (set to 1MHz) that i programmed with an arduino uno after installing Coding-Badley’s tinycore1 GitHub - Coding-Badly/TinyCore1: Tiny Core 1 for Arudino 1.6

I have attatched a poorly drawn schematic of the circuit.

this is the sketch

int LED = 0;
int speakerpin = 1;
int i = 0;
void setup() {

pinMode(LED, OUTPUT);

}

void loop() {

tone(speakerpin, 2874, 200); //plays tone for 200ms

for (int i = 255; i > 0; i–) //start at full brightness then dim
{
analogWrite(LED, i);
delay(2);
}
delay (200);
}

It works perfectly fine on the arduino uno (diffrent pin numbers ofcourse) but when running on the attiny85 the tone is quieter and lower pitch. It beeps and the LEDs dim properly but then it beeps once more and the LEDs stay on at full brightness and it stays there.

video of it with an arduino uno arduino uno test

video with an attiny attiny test

project.png

Edit: the resistors to the LEDs are 100 ohms, not 100kohms. I made a mistake in the schematic.

Well i feel like an idiot. I just burned the bootloader with the board set to 8MHz and it works now.