PinMode

From wikipost
Revision as of 09:37, 24 January 2013 by Admin (talk | contribs) (Created page with "<pre> void pinMode(int pin,int state) { if (state == OUTPUT) { (DDRB |= (1 << pin)); // set pin to output } else { (DDRB &= ~(1 << pin)); // set pin to input }…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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
  }
}