@@ -5,7 +5,8 @@ MKRIoTCarrier carrier;
55// When CARRIER_CASE is true it's set to 4 (further)
66// But if you use Buttons.updateConfig(value) It will not set the above values
77
8- unsigned int threshold = 100 ;
8+ unsigned int threshold = 98 ;
9+ unsigned int threshold_btn_0 = 95 ;
910
1011void setup () {
1112 // put your setup code here, to run once:
@@ -14,15 +15,35 @@ void setup() {
1415
1516 // CARRIER_CASE = false;
1617 // 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)
1720 carrier.Buttons .updateConfig (threshold);
21+ carrier.Button0 .updateConfig (threshold_btn_0);
1822 carrier.begin ();
1923}
2024
2125void loop () {
2226 // put your main code here, to run repeatedly:
2327 carrier.Buttons .update ();
24- // Lets test 1 button, they should all react in the same way
28+
29+ // Verify your thresholds
2530 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" );
2748 }
2849}
0 commit comments