Skip to content

Commit 5ba9bad

Browse files
authored
Added Grove Intputs example
1 parent d76cbf9 commit 5ba9bad

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include <Arduino_MKRIoTCarrier.h>
2+
MKRIoTCarrier carrier; //Constructor of the carrier maybe we can include it on the library itself
3+
4+
//Set the pad sense distance for using them with or without the enclosure
5+
bool CARRIER_CASE = false;
6+
7+
//Be sure that the Pins are the same as your wiring
8+
int moisture = A5;
9+
int moist;
10+
int pir = A6;
11+
bool trigger = false;
12+
13+
void setup() {
14+
// put your setup code here, to run once:
15+
Serial.begin(9600);
16+
while(!Serial);
17+
carrier.begin();
18+
pinMode(moisture,INPUT);
19+
pinMode(pir,INPUT);
20+
21+
}
22+
23+
void loop() {
24+
// put your main code here, to run repeatedly:
25+
//Save readings
26+
moist = analogRead(moisture);
27+
trigger = digitalRead(pir);
28+
Serial.println("Reading grove inputs A5 and A6");
29+
Serial.print("Moist: ");
30+
Serial.print(moist);
31+
Serial.print("\t Move state: ");
32+
Serial.println(digitalRead(pir));
33+
Serial.println();
34+
//delay(00);
35+
36+
}

0 commit comments

Comments
 (0)