using internal pullup resistors
hi all,
i'm trying write sketch using internal pullups in 168 , getting confused. sketch compiles & uploads, according multimeter input pins i'm using not being pulled high.
i'm trying use analog pins 0 4 marked on freeduino board. i writing correct pin no.s in sketch?
here's setup.
/*
*fivebutton
*flashes led @ various rates & on/off times depending on of 5 buttons pressed
*/
int ledpin = 13; //output pin led
int inpin1 = 0; //button 1 pin
int inpin2 = 1; //button 2 pin
int inpin3 = 2; //button 3 pin
int inpin4 = 3; //button 4 pin
int inpin5 = 4; //button 5 pin
void setup()
{
pinmode(ledpin, output); //declare led output
pinmode(inpin1, input); //declare button input
digitalwrite(0, high); //button 1 pin __turn on pullup resistors
pinmode(inpin2, input);
digitalwrite(1, high);
pinmode(inpin3, input);
digitalwrite(2, high);
pinmode(inpin4, input);
digitalwrite(3, high);
pinmode(inpin5, input);
digitalwrite(4, high);
}
thought i'd seen share of confusing hardware, has me stumped.
i'm trying write sketch using internal pullups in 168 , getting confused. sketch compiles & uploads, according multimeter input pins i'm using not being pulled high.
i'm trying use analog pins 0 4 marked on freeduino board. i writing correct pin no.s in sketch?
here's setup.
/*
*fivebutton
*flashes led @ various rates & on/off times depending on of 5 buttons pressed
*/
int ledpin = 13; //output pin led
int inpin1 = 0; //button 1 pin
int inpin2 = 1; //button 2 pin
int inpin3 = 2; //button 3 pin
int inpin4 = 3; //button 4 pin
int inpin5 = 4; //button 5 pin
void setup()
{
pinmode(ledpin, output); //declare led output
pinmode(inpin1, input); //declare button input
digitalwrite(0, high); //button 1 pin __turn on pullup resistors
pinmode(inpin2, input);
digitalwrite(1, high);
pinmode(inpin3, input);
digitalwrite(2, high);
pinmode(inpin4, input);
digitalwrite(3, high);
pinmode(inpin5, input);
digitalwrite(4, high);
}
thought i'd seen share of confusing hardware, has me stumped.

i think if going use analog input pins 0-5 digital input pins have refer them pins 14-18 in sketch. , don't blame hardware it's software 'feature' have 2 aliases same physical hardware pins. 
lefty

lefty
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > using internal pullup resistors
arduino
Comments
Post a Comment