Output current AVR lower with PORTB = _BV(0); then with digitalWrite(9, HIGH); ?

Hi, How come my LED shines less light when I use basic bit PORTB = _BV(0); then when I use digital write(like in below examples)? Arduino code:

void setup() {
  pinMode(9, OUTPUT);
}

void loop() {
  digitalWrite(9, HIGH);
}

Basic C output:

#define DDRB 0xFF

int main() {
PORTB = _BV(0);
}

When I measure the voltage over the LED + Resistor when using digitalWrite, the total voltage is 5v, but with the C operation there is no voltage over the resistor.

Does this work any differently...

int main() {
PORTB = _BV(0);
}

Ezraneut: Basic C output:

#define DDRB 0xFF

int main() { PORTB = _BV(0); }

This code doesn't seem to set the pin for OUTPUT.

...R

Robin2:

Ezraneut: Basic C output:

#define DDRB 0xFF

int main() { PORTB = _BV(0); }



This code doesn't seem to set the pin for OUTPUT.

...R

Is it in the #define? So when I say DDRB = 0xFF, does it work? I will check this evening at home.

jep, that was it. Solved.

int main() {
DDRB = 0xFF;
while(1){
PORTB = _BV(0);
}
}