Step 2The Touch-Sensor
You see, each Pin (well most of them anyway) in the PIC microcontroller can be programmed during runtime to be INPUT, OUTPUT(HIGH or LOW) or just to be FLOATING on a tri-state condition...
What you need to do is (look at the schematics so you'll understand)
+Put Pin on High (gp_0)
+Let it Float (gp_0)
+Wait some time and read it's value with same pin or another one (gp1)
if a person is holding his finger between the finger contacts the capacitance of the pin is greatly increased , this way the gap of time that the Pin will take to discharge (during float) will be much larger than normal operation (no finger)... now look at the code below using two pins:
int fingert; int check_finger(){ for(fingert=0;fingert<100;fingert++) //redundance (just to make sure) { output_high(PIN_A0); delay_us(10); output_float(PIN_A0); delay_us(500); if( input(PIN_A1) ) { return 1; } } return 0;} | « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|








































