Measure capacitances by counting rising edges of a 555 astable oscillator.
Dependencies: 4DGL-uLCD-SE mbed
Diff: main.cpp
- Revision:
- 0:292d0c987fe3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Mar 24 19:47:55 2014 +0000 @@ -0,0 +1,22 @@ +#include "mbed.h" +#include "capSense.h" +#include "uLCD_4DGL.h" + + +#define RA 19770 // ohms +#define RB 9053 // ohms +#define PERIOD 2000000 //us + +uLCD_4DGL uLCD(p9, p10, p11); // lcd connection +CapSense cap(RA, RB, PERIOD, p21); + +int main() { + uLCD.locate(3,5); //setting the cursor to the middle + + while(1) { + uLCD.locate(0,6); // setting cursor + float capacitance = cap.measure(); + uLCD.printf("Capacitance:\n%f uF \n\n", capacitance); + uLCD.printf("Frequency:\n%f Hz ",(float)cap._count/PERIOD*1000000); + } +} \ No newline at end of file