I won’t make this post long. Here’s the situation:
- Burn bootloader successfully (also tried optiboot and it worked)
- Upload blink sketch using int led = 9
- Led blinks on pin 9 (PB1)!
- Upload blink sketch using int led = 10
- Led doesn’t blink on pin 10 (PB2) <-------------- Problem starts here!
- Led blinks on pin 8 (PB0) - huh?
- Upload sketch using some other pin and only pin 8 works / sometimes none work
- Reburn the bootloader and the led blinks on e.g. pin A5 if set in sketch (but not after 2nd upload)
- The problem starts again
I don’t have a problem with uploading or burning the bootloader to the atmega8a-pu, but the pins misbehave after the 2nd upload. I have a external 16mhz xtal hooked up (8mhz internal also works).
I’m hoping that someone might recognize the problem and have a solution. I’ve tried looking and haven’t found anything yet. Obviously I could always burn the bootloader everytime before uploading my code, but it feels a bit unnecessary. Could this be something to do with pin assignments getting mangled up? I apologize if this question has been asked before or if I’ve overlooked the solution.