1
- /* This sketch will test everything on the carrier board
2
-
3
- This library "Arduino_IOTSKcarrier.h" wraps the 4 sensor's libraries to make it more compact
4
- It has also the Relays to make it easier to use them
5
-
6
- The TFT display library is accesed by "display" instead of "tft"
7
-
8
- Below you will see how to access everything inside the Carrier, not every functionalities
1
+ /*
2
+ This sketch will test the carrier board
3
+ Unless the touch pads
9
4
*/
10
5
11
6
#include < Arduino_MKRIoTCarrier.h>
@@ -31,22 +26,21 @@ void setup() {
31
26
Serial.begin (9600 );
32
27
while (!Serial); // Wait to open the Serial monitor to start the program and see details on errors
33
28
34
- // SD card
35
- // You can init the SD card with SD.begin(SD_CS)
36
- // SD_CS refers to pin 0
37
-
38
29
// Init everything and outputs the errors
39
30
carrier.begin ();
40
-
41
-
42
31
}
43
32
44
33
void loop () {
45
34
// put your main code here, to run repeatedly:
46
35
// LED show up
47
36
// ( led index , red , green , blue )
48
- carrier.leds .setPixelColor (0 , 0 , 0 , 20 );
37
+ carrier.leds .setPixelColor (0 , 0 , 0 , 20 );
38
+ carrier.leds .setPixelColor (1 , 0 , 20 , 0 );
39
+ carrier.leds .setPixelColor (2 , 20 , 0 , 0 );
40
+ carrier.leds .setPixelColor (3 , 0 , 20 , 20 );
41
+ carrier.leds .setPixelColor (4 , 20 , 20 , 20 );
49
42
carrier.leds .show ();
43
+
50
44
// Function to display
51
45
displayTitle ();
52
46
@@ -60,8 +54,8 @@ void loop() {
60
54
61
55
// Simple relay open and close loop
62
56
/* Relay function
63
- open() - goes to Normally Open (NO) circuit, status LED will be OFF
64
- close() - goes to Normally Close (NC) cirucit, status LED will be ON
57
+ open() - goes to Normally Open (NO) circuit, status LED will be ON
58
+ close() - goes to Normally Close (NC) cirucit, status LED will be OFF
65
59
*/
66
60
carrier.Relay1 .close ();
67
61
delay (1000 );
@@ -86,9 +80,8 @@ void loop() {
86
80
87
81
delay (1000 );
88
82
89
-
90
83
// SENSORS
91
- // Ambient light sensor
84
+ // RGB and Light sensor
92
85
// It set the values that you point inside the brackets
93
86
while (! carrier.Light .colorAvailable ()) {
94
87
delay (5 );
@@ -99,7 +92,7 @@ void loop() {
99
92
Serial.println (light);
100
93
displayLight ();
101
94
102
- // Env sensor
95
+ // Env sensor (Temp and Hum)
103
96
temperature = carrier.Env .readTemperature ();
104
97
humidity = carrier.Env .readHumidity ();
105
98
Serial.println (" Env sensor" );
0 commit comments