PinMode

From wikipost
Jump to navigation Jump to search
void pinMode(int pin,int state)
{ 
  if (state == OUTPUT)
  {
    (DDRB |= (1 << pin));  // set pin to output
  } else { 
    (DDRB &= ~(1 << pin)); // set pin to input
  }
}