Please explain this (nunchuck) code to me


i having hard time understand code below. part of code can used wii nunchuck , thingm adapter nunchuck. understand code define power , gnd nunchuk, don't see exactly.

code: [select]
// uses port c (analog in) pins power & ground nunchuck
static void nunchuck_setpowerpins()
{
#define pwrpin portc3
#define gndpin portc2
   ddrc |= _bv(pwrpin) | _bv(gndpin);
   portc &=~ _bv(gndpin);
   portc |=  _bv(pwrpin);
   delay(100);  // wait things stabilize        
}


from comment in first line understand code used power nunchuck. know (similar) code can used shut off power (if possible).

thank in advance!

that code same this:

code: [select]
static void nunchuck_setpowerpins()
{
  pinmode(16, output);   // arduino analog pin 2
  pinmode(17, output);   // arduino analog pin 3
  digitalwrite(16,low);
  digitalwrite(17,high);
  delay(100);  // wait things stabilize
}


you can turn off power doing digitalwrite(17,low);


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Please explain this (nunchuck) code to me


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums