@@ -5,7 +5,8 @@ MKRIoTCarrier carrier;
5
5
// When CARRIER_CASE is true it's set to 4 (further)
6
6
// But if you use Buttons.updateConfig(value) It will not set the above values
7
7
8
- unsigned int threshold = 100 ;
8
+ unsigned int threshold = 98 ;
9
+ unsigned int threshold_btn_0 = 95 ;
9
10
10
11
void setup () {
11
12
// put your setup code here, to run once:
@@ -14,15 +15,35 @@ void setup() {
14
15
15
16
// CARRIER_CASE = false;
16
17
// Now we can set our custom touch threshold
18
+ // First we update all the buttons with the new threshold
19
+ // Then we overwrite individually one of them (they can be all set individually too)
17
20
carrier.Buttons .updateConfig (threshold);
21
+ carrier.Button0 .updateConfig (threshold_btn_0);
18
22
carrier.begin ();
19
23
}
20
24
21
25
void loop () {
22
26
// put your main code here, to run repeatedly:
23
27
carrier.Buttons .update ();
24
- // Lets test 1 button, they should all react in the same way
28
+
29
+ // Verify your thresholds
25
30
if (carrier.Button0 .getTouch ()) {
26
- Serial.println (" touching" );
31
+ Serial.println (" touching 0" );
32
+ }
33
+
34
+ if (carrier.Button1 .getTouch ()) {
35
+ Serial.println (" touching 1" );
36
+ }
37
+
38
+ if (carrier.Button2 .getTouch ()) {
39
+ Serial.println (" touching 2" );
40
+ }
41
+
42
+ if (carrier.Button3 .getTouch ()) {
43
+ Serial.println (" touching 3" );
44
+ }
45
+
46
+ if (carrier.Button4 .getTouch ()) {
47
+ Serial.println (" touching 4" );
27
48
}
28
49
}
0 commit comments