You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,28 +39,28 @@ At the start of your sketch, the library header file is included using the follo
39
39
Before the arduino ```setup()``` function, create a Soil Sensor object in your file with the following declaration:
40
40
41
41
For I2C bus:
42
-
```c++
42
+
~~~c++
43
43
SparkFunSoilMoistureSensorI2C mySoilSensor; // Create an instance of the sensor class
44
-
```
44
+
~~~
45
45
46
46
For SPI bus:
47
-
```c++
47
+
~~~c++
48
48
SparkFunSoilMoistureSensorSPI mySoilSensor; // Create an instance of the sensor class
49
-
```
49
+
~~~
50
50
51
51
52
52
### Initialization
53
53
54
54
In the Arduino ```setup()``` function, initialize the sensor by calling the begin method. This method is called after the Arduino `Wire` (I2C) library is initialized.
55
55
56
-
```c++
56
+
~~~c++
57
57
if (mySoilSensor.begin() == false)
58
58
{
59
59
Serial.println("Soil Moisture Sensor not detected at default I2C address. Verify the sensor is connected. Stopping.");
60
60
while (1)
61
61
;
62
62
}
63
-
```
63
+
~~~
64
64
65
65
The begin method returns true if the sensor is connected and available, and false if it is not. If a value of ```false``` is returned in the above example, the sketch execution is halted.
0 commit comments