basic stuff I know but Im banging my head against a wall
Im trying to READ a pin (see if Its set high or low by a switch and
turning on another testpin - LED on the basis of that
the (supposedly) input pin is on PinE1 (on testpin2)
the output pin iis on PINEo (Testpin 1)
this is my definitions
#define TESTPIN2 (PINE, 0x01)
#define TESTPIN1_HI sbi(PORTE, 0x00)
#define TESTPIN2_HI sbi(PORTE, 0x01)
#define TESTPIN2_IN cbi(DDRE, 0x01)
#define TESTPIN1_LO cbi(PORTE, 0x00)
#define TESTPIN2_LO cbi(PORTE, 0x01)
//init_devices();
while (!stop)
{
TESTPIN1_HI; //light led
TESTPIN2_IN;//set direction of input pin (DDRE)
if ((TESTPIN2 == 0) //if switch is off
TESTPIN1_LO;
}
but nothing happens after the led comes on the first time
regardless of the polarity put on the TESTPIN2
can anyone help?
thanks
BrenMessage
reading a pin
2004-02-19 by inpactmicro
Attachments
- No local attachments were found for this message.