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
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
void pinMode(int pin,int state)
{ 
  if (state == OUTPUT)
  {
    (DDRB |= (1 << pin));  // set pin to output
  } else { 
    (DDRB &= ~(1 << pin)); // set pin to input
  }
}