File tree 1 file changed +28
-0
lines changed
examples/TouchPads/Custom_Sensitivity
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include " Arduino_MKRIoTCarrier.h"
2
+ MKRIoTCarrier carrier;
3
+ bool CARRIER_CASE = false ;
4
+
5
+ // When CARRIER_CASE is false it's set to 100 (closer)
6
+ // When CARRIER_CASE is true it's set to 4 (further)
7
+ // But if you use Buttons.updateConfig(value) It will not set the above values
8
+
9
+ unsigned int trheshold = 100 ;
10
+
11
+ void setup () {
12
+ // put your setup code here, to run once:
13
+ Serial.begin (9600 );
14
+ while (!Serial);
15
+
16
+ // Now we can set our custom touch trheshold
17
+ carrier.Buttons .updateConfig (trheshold);
18
+ carrier.begin ();
19
+ }
20
+
21
+ void loop () {
22
+ // put your main code here, to run repeatedly:
23
+ carrier.Buttons .update ();
24
+ // Lets test 1 button, they should all react in the same way
25
+ if (carrier.Button1 .getTouch ()) {
26
+ Serial.println (" touching" );
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments