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.
from comment in first line understand code used power nunchuck. know (similar) code can used shut off power (if possible).
thank in advance!
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:
you can turn off power doing digitalwrite(17,low);
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
Post a Comment