Skip to content

Commit d0e825c

Browse files
committed
Added Modulino Farad example
1 parent 2545f82 commit d0e825c

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
}

0 commit comments

Comments
 (0)