Skip to content

Commit b2c2f10

Browse files
authored
Added custom sensitivity Example
This Example shows to the user how to change the threshold of the touch pads.
1 parent 5ba9bad commit b2c2f10

File tree

1 file changed

+28
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)