output digital signal

Following code is to enable PORTB as output and set it high.

A pullup resistor will be required at input PORTB2.

# include <avr/io.h>

int main (void)

{

DDRB = 0xFF;// set all pins on PORTB for output

while (1)

{

PORTB |= (1<<PB1); // set Port PB1 high

}

return 0;

}