Skip to content

Commit 1d0940a

Browse files
committed
change code + images
1 parent a66e554 commit 1d0940a

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed
32.3 KB
Loading
9.47 KB
Loading

content/hardware/01.mkr/03.carriers/mkr-iot-carrier/tutorials/smart-garden-project/smart-garden-project.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Begin by navigating to the [Arduino IoT Cloud](https://create.arduino.cc/iot/thi
7171
| moisture | int | Read moisture | Read Only |
7272
| temperature | float | Read temperature | Read Only |
7373
| humidity | float | Read humidity | Read Only |
74+
| log_message | String | Message Log | Read Only |
7475

7576
**3.** Enter your credentials to your Wi-Fi network in the network section.
7677

@@ -81,13 +82,36 @@ Begin by navigating to the [Arduino IoT Cloud](https://create.arduino.cc/iot/thi
8182
**5.** Go to the sketch tab, and use the following code:
8283

8384
```arduino
85+
86+
/*
87+
MKR IoT Carrier Smart Garden Setup Project
88+
89+
A setup that allows for remote/local control of
90+
a pump, as well as reading sensors (moisture,
91+
temperature, humidity).
92+
93+
Built using the Arduino IoT Cloud service.
94+
95+
Components used:
96+
- MKR WiFi 1010
97+
- MKR IoT Carrier
98+
- Moisture Sensor
99+
- 5V water pump
100+
- USB Adapter with 2x slots
101+
- Micro USB Cable
102+
- Open ended USB Cable
103+
- Grove cable
104+
105+
Code by (c) Alessandro Ranelucci for Arduino.
106+
*/
107+
84108
#include "arduino_secrets.h"
85109
#include "thingProperties.h"
86110
87111
#include <Arduino_MKRIoTCarrier.h>
88112
#include <Arduino_OplaUI.h>
89113
90-
const int moistPin = A5;
114+
const int moistPin = A6;
91115
const float waterAmount = 2; // liters
92116
const float waterSpeed = 0.045; // liters/sec
93117
const float waterTime = waterAmount / waterSpeed; // seconds
@@ -142,6 +166,9 @@ void loop() {
142166
raw_moisture = analogRead(moistPin);
143167
moisture = map(raw_moisture, 780, 1023, 100, 0);
144168
169+
temperature = carrier.Env.readTemperature();
170+
humidity = carrier.Env.readHumidity();
171+
145172
// Set the LED color according to the moisture percentage
146173
if (moisture > 40) {
147174
opla.leds.setPixelColor(1, 50, 0 , 0); // green
@@ -193,7 +220,7 @@ void stopWatering () {
193220

194221
Once you see the values changing, we know that the connection is successful, and we can monitor and interact with our device.
195222

196-
***In this dashboard, we replaced some of the widgets with more nicer representations, like gauges and percentage.***
223+
***In this dashboard, we replaced some of the widgets with nicer representations, like gauges and percentage.***
197224

198225
## Final Setup
199226

0 commit comments

Comments
 (0)