|
Sorry, my first post indicated I was using a school board. I'm using a docking module having two pushbutton switches (SW2, SW3) and two LEDs (D2, D3). I'm trying to turn on LED D2 at PT0 by pressing SW2 at PAD06. How do I setup the PAD06 pin for an input?
Here's the code snipet:
dim SW2 as new DIO(PAD06) //define pushbutton switch SW2 at PAD06 dim LED_D2 as new DIO(PT0) //define DIO object as LED D2 at PT0-pin
main SW2.PIN_Dir(PAD06,DIR_INPUT) //setup PAD06 as input from SW2, pulldown when pressed SW2.PIN_In(PAD06,SW2) //setup PAD06 as input from SW2, hi when released, lo when pressed
while(FOREVER) if (SW2 == 0) //SW2 pressed = PAD06 is low LED_D2.PIN_Out (PT0,ON) //Turn LED D2 ON else LED_D2.PIN_Out (PT0,OFF) //Turn LED D2 OFF end if end while
These first two lines in main seem to do the same thing, I get no compile errors, but no LED lights. How does one properly set PAD06 for input?
|