File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
examples/Modulino_Farad/basic Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ FDC1004 - basic
3+
4+ This example reads data from Modulino Farad
5+ With this settings you can read channel 1.
6+ Offset and gain are set to Zero.
7+
8+
9+ This example code is in the public domain.
10+ */
11+ #include < Wire.h>
12+ #include " Modulino.h"
13+
14+ uint16_t reg_read;
15+ int measured_cap;
16+ ModulinoFarad farad;
17+
18+ void setup () {
19+ // put your setup code here, to run once:
20+ Serial.begin (9600 );
21+ Modulino.begin ();
22+ farad.begin ();
23+ // Offset settings - Value set to Zero
24+ farad.channelOffset (CHANNEL1,0x00 );
25+ // Channel settings - Channel 1 will measure the capacitance on input CIN1sa and the offset is set to Zero
26+ farad.channelSettings (CHANNEL1,CIN1,CAPDAC,0x00 );
27+ // Measure settings - Channel 1 enabled, sample rate is 100 Samples/sec and measure is repeated
28+ farad.measurementSettings (MEAS_1_EN,RATE_100Ss,REPEAT_ENABLED);
29+
30+ }
31+
32+ void loop () {
33+ // put your main code here, to run repeatedly:
34+ if (farad.measureAvailable (CHANNEL1))
35+ {
36+ measured_cap = farad.getMeasure (CHANNEL1);
37+ Serial.print (" The Value of the measured Capacitance is " );
38+ Serial.println (measured_cap);
39+ }
40+ delay (200 );
41+ }
You can’t perform that action at this time.
0 commit comments