Enormous thanks to everyone for the help on the last project. That's now done and working well, and I'm on to something bigger and just as inexplicably nonfunctional. I have the PIC wired with a metal lamp between pins 3 and 4, and an LED between pin 0 and ground. The idea here is to charge and discharge the body of the lamp very quickly, and if at any point discharging takes too long, that indicates human contact and accompanying increase in capacitance. Instead, the LED just flickers very quickly and dimly regardless of input. The wait time here is very high just to make sure that the lamp lights, which it fails to. Any ideas?? -Eli #include #define LED GPIO0 #define OFF 0 #define ON 1 #define EMITTOR GPIO2 void checkFinger(void); void init(void); void delay(int delay); void toggleLED(void); void main(void){ init(); LED = ON; while(1){ checkFinger(); } } int z; void checkFinger(void){ EMITTOR = 1; for (z = 0; z < 300; z++) NOP(); if (GPIO3 == 1) toggleLED(); EMITTOR = 0; delay(200); } void toggleLED(void){ if (LED == ON) LED = OFF; else LED = ON; } void init(void){ ANS3 = 0; VRCON = 0; //Turn Off Voltage Reference Peripheral CMCON = 0x07; //Turn Off Comparator Peripheral TMR0 = 0; //Clear Timer0 OPTION = 0x80; TRIS3 = 1; TRIS2 = 0; TRIS0 = 0; // INTCON = 0; /* IOCB4 = 1; //interrupt on change for pin 4 is on IOCB = 0x00010000; GPIE = 1; T0IF = 0; T0IE = 1; */ } void delay(int delay){ int x, y; for (x = 0; x< delay; x++){ for (y = 0; y<100; y++){ NOP(); } } } -- View this message in context: http://www.nabble.com/newb%27s-capacitance-switch-implementation-tp17995271p17995271.html Sent from the PIC - [PIC] mailing list archive at Nabble.com. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist