0

I can get PB4 to work but not PB3 on my ATtinny85. I'm just lighting up an led (with 150 ohm resistor) (using internal 16mhz)

void setup() {
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);

}
void loop() {
  analogWrite(3, 15);//does not work
  analogWrite(4, 15);//works
  delay(500); 
  analogWrite(3, 0);//does not work
  analogWrite(4, 0);//works
  delay(500);
}

enter image description here

  • 1
    According to the diagram, only PB0 and PB1 support PWM (purple). – Gerben Dec 27 '19 at 19:22
1

The hardware PWM is only suported on pins with output compare altenate function on it. The pinout in your question shows Attiny13 but the rest of your question is about Attiny85, which has different capabilities from Attiny13

Attiny85 pinout

As you can see, only pins with PWM capability are PB0, PB1 and PB4

  • ohhh, thank you, i didn't even realize i was looking at the 13a pinout by mistake – Valkor Simpson Dec 28 '19 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.