Now to your code.
You use the pin number "0" and hope to have PB3. Well, according to this shamelessly linked pinout this is not correct:
Pin "0" is PA0.
PB3 has no number assigned.
Your next step could be to look up the sources of the Arduino library and check, if PB3 has a number assigned at all. I'm afraid this is not the case. If you're lucky and it has, use it. You will want to tell us about your finding then.
You can directly access the data direction control register and the port register. Grab your data sheet and other documentation, read, and implement.
This is untested:
// in setup():
DDRB |= (uint8_t)(1U << 3);
// in loop():
PORTB |= (uint8_t)(1U << 3); // set PB3 to "high"
PORTB &= ~((uint8_t)(1U << 3)); // set PB3 to "low"
Now to your code.
You use the pin number "0" and hope to have PB3. Well, according to this shamelessly linked pinout this is not correct:
Pin "0" is PA0.
PB3 has no number assigned.
Your next step could be to look up the sources of the Arduino library and check, if PB3 has a number assigned at all. I'm afraid this is not the case. If you're lucky and it has, use it. You will want to tell us about your finding then.
You can directly access the data direction control register and the port register. Grab your data sheet and other documentation, read, and implement.
This is untested:
// in setup():
DDRB |= (uint8_t)(1U << 3);
// in loop():
PORTB |= (uint8_t)(1U << 3); // set PB3 to "high"
PORTB &= ~((uint8_t)(1U << 3)); // set PB3 to "low"
The data sheet data sheet gives insights:
Chapter 1.1.4 says thatstates:
The reset pin can also be used as a (weak) I/O pin.
"Weak" means here, that the output function cannot deliver as much current as the other outputs, according to figures 21-8724 to 21-9027 beginning at page 232 it is198 roughly 1 to 2 to 3 mA. This is commonly not enough for LEDs, except you use a high-efficiency LED.
And on page 7166 is this relevant table (I cut the irrelevant column for PB2):
Table 10-8. Overriding Signals for Alternate Functions in PB[3:2]
Signal Name PB3/RESET/dW/PCINT11 PUOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PUOV 1 DDOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) DDOV DEBUGWIRE_ENABLE(2) • debugWire Transmit PVOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PVOV 0 PTOE 0 DIEOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) + PCINT11 • PCIE1 DIEOV DEBUGWIRE_ENABLE(2) + (RSTDISBL(1) • PCINT11 • PCIE1) DI dW/PCINT11 Input AIO Note:
- RSTDISBL is 1 when the Fuse is "0" (Programmed).
- DebugWIRE is enabled when DWEN Fuse is programmed and Lock bits are unprogrammed.
Since you have DebugWIRE
enabled, this seems to be the cause. The alternate function RESET
is still active.
Please be aware that according to note 1 below table 19-4 on page 165160:
After programming the RSTDISBL fuse, high-voltage serial programming must be used to change fuses and allow further programming.
This means that your circuit at PB3 needs to withstand the high voltage, and that the voltage source needs to provide enough current, thatwhich the circuit additionally draws at the high voltage.
The data sheet gives insights:
Chapter 1.1.4 says that
The reset pin can also be used as a (weak) I/O pin.
"Weak" means here, that the output function cannot deliver as much current as the other outputs, according to figures 21-87 to 21-90 beginning at page 232 it is roughly 1 to 2 mA.
And on page 71 is this relevant table (I cut the irrelevant column for PB2):
Table 10-8. Overriding Signals for Alternate Functions in PB[3:2]
Signal Name PB3/RESET/dW/PCINT11 PUOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PUOV 1 DDOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) DDOV DEBUGWIRE_ENABLE(2) • debugWire Transmit PVOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PVOV 0 PTOE 0 DIEOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) + PCINT11 • PCIE1 DIEOV DEBUGWIRE_ENABLE(2) + (RSTDISBL(1) • PCINT11 • PCIE1) DI dW/PCINT11 Input AIO Note:
- RSTDISBL is 1 when the Fuse is "0" (Programmed).
- DebugWIRE is enabled when DWEN Fuse is programmed and Lock bits are unprogrammed.
Since you have DebugWIRE
enabled, this seems to be the cause. The alternate function RESET
is still active.
Please be aware that according to note 1 below table 19-4 on page 165:
After programming the RSTDISBL fuse, high-voltage serial programming must be used to change fuses and allow further programming.
This means that your circuit at PB3 needs to withstand the high voltage, and that the voltage source needs to provide enough current, that the circuit draws.
The data sheet gives insights:
Chapter 1.1.4 states:
The reset pin can also be used as a (weak) I/O pin.
"Weak" means here, that the output function cannot deliver as much current as the other outputs, according to figures 21-24 to 21-27 beginning at page 198 roughly 2 to 3 mA. This is commonly not enough for LEDs, except you use a high-efficiency LED.
And on page 66 is this relevant table (I cut the irrelevant column for PB2):
Table 10-8. Overriding Signals for Alternate Functions in PB[3:2]
Signal Name PB3/RESET/dW/PCINT11 PUOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PUOV 1 DDOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) DDOV DEBUGWIRE_ENABLE(2) • debugWire Transmit PVOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PVOV 0 PTOE 0 DIEOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) + PCINT11 • PCIE1 DIEOV DEBUGWIRE_ENABLE(2) + (RSTDISBL(1) • PCINT11 • PCIE1) DI dW/PCINT11 Input AIO Note:
- RSTDISBL is 1 when the Fuse is "0" (Programmed).
- DebugWIRE is enabled when DWEN Fuse is programmed and Lock bits are unprogrammed.
Since you have DebugWIRE
enabled, this seems to be the cause. The alternate function RESET
is still active.
Please be aware that according to note 1 below table 19-4 on page 160:
After programming the RSTDISBL fuse, high-voltage serial programming must be used to change fuses and allow further programming.
This means that your circuit at PB3 needs to withstand the high voltage, and that the voltage source needs to provide enough current, which the circuit additionally draws at the high voltage.
The data sheet gives insights:
Chapter 1.1.4 says that
The reset pin can also be used as a (weak) I/O pin.
You might need to investigate what "weakWeak" means here, that the output function cannot deliver as much current as the other outputs, according to figures 21-87 to 21-90 beginning at page 232 it is roughly 1 to 2 mA.
And on page 71 is this relevant table (I cut the irrelevant column for PB2):
Table 10-8. Overriding Signals for Alternate Functions in PB[3:2]
Signal Name PB3/RESET/dW/PCINT11 PUOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PUOV 1 DDOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) DDOV DEBUGWIRE_ENABLE(2) • debugWire Transmit PVOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PVOV 0 PTOE 0 DIEOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) + PCINT11 • PCIE1 DIEOV DEBUGWIRE_ENABLE(2) + (RSTDISBL(1) • PCINT11 • PCIE1) DI dW/PCINT11 Input AIO Note:
- RSTDISBL is 1 when the Fuse is "0" (Programmed).
- DebugWIRE is enabled when DWEN Fuse is programmed and Lock bits are unprogrammed.
Since you have DebugWIRE
enabled, this seems to be the cause. The alternate function RESET
is still active.
Please be aware that according to note 1 below table 19-4 on page 165:
After programming the RSTDISBL fuse, high-voltage serial programming must be used to change fuses and allow further programming.
This means that your circuit at PB3 needs to withstand the high voltage, and that the voltage source needs to provide enough current, that the circuit draws.
The data sheet gives insights:
Chapter 1.1.4 says that
The reset pin can also be used as a (weak) I/O pin.
You might need to investigate what "weak" means here.
And on page 71 is this relevant table (I cut the irrelevant column for PB2):
Table 10-8. Overriding Signals for Alternate Functions in PB[3:2]
Signal Name PB3/RESET/dW/PCINT11 PUOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PUOV 1 DDOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) DDOV DEBUGWIRE_ENABLE(2) • debugWire Transmit PVOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PVOV 0 PTOE 0 DIEOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) + PCINT11 • PCIE1 DIEOV DEBUGWIRE_ENABLE(2) + (RSTDISBL(1) • PCINT11 • PCIE1) DI dW/PCINT11 Input AIO Note:
- RSTDISBL is 1 when the Fuse is "0" (Programmed).
- DebugWIRE is enabled when DWEN Fuse is programmed and Lock bits are unprogrammed.
Since you have DebugWIRE
enabled, this seems to be the cause. The alternate function RESET
is still active.
Please be aware that according to note 1 below table 19-4 on page 165:
After programming the RSTDISBL fuse, high-voltage serial programming must be used to change fuses and allow further programming.
This means that your circuit at PB3 needs to withstand the high voltage, and that the voltage source needs to provide enough current, that the circuit draws.
The data sheet gives insights:
Chapter 1.1.4 says that
The reset pin can also be used as a (weak) I/O pin.
"Weak" means here, that the output function cannot deliver as much current as the other outputs, according to figures 21-87 to 21-90 beginning at page 232 it is roughly 1 to 2 mA.
And on page 71 is this relevant table (I cut the irrelevant column for PB2):
Table 10-8. Overriding Signals for Alternate Functions in PB[3:2]
Signal Name PB3/RESET/dW/PCINT11 PUOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PUOV 1 DDOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) DDOV DEBUGWIRE_ENABLE(2) • debugWire Transmit PVOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) PVOV 0 PTOE 0 DIEOE RSTDISBL(1) + DEBUGWIRE_ENABLE(2) + PCINT11 • PCIE1 DIEOV DEBUGWIRE_ENABLE(2) + (RSTDISBL(1) • PCINT11 • PCIE1) DI dW/PCINT11 Input AIO Note:
- RSTDISBL is 1 when the Fuse is "0" (Programmed).
- DebugWIRE is enabled when DWEN Fuse is programmed and Lock bits are unprogrammed.
Since you have DebugWIRE
enabled, this seems to be the cause. The alternate function RESET
is still active.
Please be aware that according to note 1 below table 19-4 on page 165:
After programming the RSTDISBL fuse, high-voltage serial programming must be used to change fuses and allow further programming.
This means that your circuit at PB3 needs to withstand the high voltage, and that the voltage source needs to provide enough current, that the circuit draws.