Hello, I’m very novice with Arduino, but for my first project, I would like to make a smart greenhouse. For that, I’m using different grove sensors, Arduino Uno and the base shield V.2… I have different sensors as the moisture sensor which is supposed to print on my display the value. I bought the W600 grove module to send those values on a Cloud like ThingSpeak, Dweet.io … I checked the W600 library but I only found some exemple to connect the module to internet, I don’t really know how to use it to send my data on the cloud.
I didn’t find many stuff on google concerning the use of W600 grove.
I would like to know how to use the W600 library to send my data on the cloud. Thank you for your answer!
I put the part of my code concerned, and the sta_mode_connect exemple of the library. This is the part of my code which is supposed to read the value of the moisture sensor:
const int moistureSensor = A0;
void setup() {
Serial.begin(9600);
pinMode(moistureSensor, INPUT);
}
void loop() {
int moistureRaw = analogRead(moistureSensor);
int moistureReal = map(moistureRaw, 950, 0, 0, 100); //950 is the max moisture value
Serial.print("Moisture of the plant : ");
Serial.println(moistureReal);
Serial.print(" % ");
delay(1000);
}
And this is the exemple sta_mode_connect in the speed W600 library :
#include "seeed_w600.h"
// Architecture specific include
#if defined(ARDUINO_ARCH_AVR)
#pragma message("Defined architecture for ARDUINO_ARCH_AVR.")
SoftwareSerial softSerial(2, 3);
#define SERIAL Serial
#elif defined(ARDUINO_ARCH_SAM)
#pragma message("Defined architecture for ARDUINO_ARCH_SAM.")
#define SERIAL SerialUSB
#elif defined(ARDUINO_ARCH_SAMD)
#pragma message("Defined architecture for ARDUINO_ARCH_SAMD.")
#define SERIAL SerialUSB
#elif defined(ARDUINO_ARCH_STM32F4)
#pragma message("Defined architecture for ARDUINO_ARCH_STM32F4.")
#define SERIAL SerialUSB
#else
SoftwareSerial softSerial(2, 3);
#define SERIAL Serial
#endif
#define debug SERIAL
String msg;
AtWifi wifi;
String SSID = "STU-EE";
String PSWD = "stu-ee-2022";
void setup() {
debug.begin(115200);
#if defined(SAMD21)
wifi.begin(Serial, 9600);
#else
wifi.begin(softSerial, 9600);
#endif
wifi.wifiReset();
delay(1000);
if (!wifi.wifiSetMode(STA)) {
debug.println("Set config mode failed!");
return ;
}
delay(100);
if (!wifi.wifiStaSetTargetApSsid(SSID)) {
debug.println("Set target AP ssid failed!!");
return;
}
delay(100);
if (!wifi.wifiStaSetTargetApPswd(PSWD)) {
debug.println("Set target AP password failed!!");
return;
}
delay(100);
if (!wifi.joinNetwork()) {
debug.println("Join to AP network failed!!");
return;
}
debug.println("Connect to target wifi : ");
debug.print("Target AP SSID = ");
debug.println(SSID);
debug.print("Target AP PSWD = ");
debug.println(PSWD);
debug.println("OK!");
}
void loop() {
delay(1000);
if (wifi.getWifiConnectStatus(msg)) {
debug.println("My IP = [status],[ip],[netmask],[gateway],[dns] : ");
debug.println(msg);
while (1);
}
}