5
5
*
6
6
* SPDX-License-Identifier: MIT
7
7
*
8
- * This example demonstrates how to read the soil moisture sensor value and use the mositure value to control the on-board LED
9
- * flash rate. The drier the soil, the faster the LED flashes.
10
- *
8
+ * This example demonstrates how to read the soil moisture sensor value and use the moisture value to control the
9
+ * on-board LED flash rate. The drier the soil, the faster the LED flashes.
10
+ *
11
11
* Supported Sensor:
12
12
* Qwiic Soil Moisture Sensor https://www.sparkfun.com/sparkfun-qwiic-soil-moisture-sensor.html
13
- *
13
+ *
14
14
* Hardware Connections:
15
- * - Connect the Qwiic Soil Moisture Sensor to the Qwiic connector of your development board (SparkFun Thing Plus, ReadBoard ...etc.)
16
- * If you don't have a development board with a Qwiic connector, you can purchase one at sparkfun.com
15
+ * - Connect the Qwiic Soil Moisture Sensor to the Qwiic connector of your development board (SparkFun Thing Plus,
16
+ * RedBoard ...etc.) If you don't have a development board with a Qwiic connector, you can purchase one at sparkfun.com
17
17
* - Connect the development board to your computer using a USB cable.
18
18
* - Open the Serial Monitor at a baud rate of 115200 to see the sketch output.
19
- *
19
+ *
20
20
*---------------------------------------------------------------------------------
21
21
*/
22
22
@@ -58,8 +58,8 @@ SparkFunSoilMoistureSensorI2C mySoilSensor; // Create an instance of the sensor
58
58
// Time between loop iterations - Just make it the same as our FAST RATE.
59
59
#define LOOP_DELAY FAST_FLASH_RATE
60
60
61
- // Time between Soil Moisture readings - 30 seconds
62
- #define SOIL_MOISTURE_READ_RATE 30000
61
+ // Time between Soil Moisture readings - 15 seconds
62
+ #define SOIL_MOISTURE_READ_RATE 15000
63
63
64
64
// Define a variable for the last blink time - in ms since boot
65
65
uint32_t lastBlinkTime = 0 ;
@@ -139,7 +139,7 @@ void setup()
139
139
140
140
// initial last blink time - now!
141
141
lastBlinkTime = millis ();
142
- // initial last sensor read time - just 0;
142
+ // initial last sensor read time - just 0;
143
143
lastSensorReadTime = 0 ;
144
144
145
145
Serial.println (" Reading soil moisture sensor..." );
@@ -217,7 +217,7 @@ void checkSensorValue(void)
217
217
{
218
218
blinkRate = newBlinkRate;
219
219
Serial.print (" New blink delay: " );
220
- Serial.print (blinkRate/ 1000 );
220
+ Serial.print (blinkRate / 1000 );
221
221
Serial.println (" seconds" );
222
222
}
223
223
// update the last read time
@@ -227,8 +227,8 @@ void checkSensorValue(void)
227
227
// ----------------------------------------------------------------------------------------
228
228
void loop ()
229
229
{
230
- // check if we need to flash the LED
231
- checkForLEDBlink ();
230
+ // check if we need to flash the LED
231
+ checkForLEDBlink ();
232
232
233
233
// Need to output/get the sensor value?
234
234
checkSensorValue ();
0 commit comments