Hi everybody,
I am using a wio GPS Boarder for the first time. I did all the procedure described on seed’s website to configure wio with arduino IDE but when compile my code (for temperature and humidity sensor) , a lot of time it shows that the croquits can’t be compiled and sometimes it shows compilation finish but I can’t see the result in Serial monitor.
I am using windows 10, and just the USB not battery to power the boarder.
have someone already resolve this kind of problem or if someone how to resolve it , please a need your help.
Hi there~
Please post the software code. For the Serial print, you have to use SerialUSB.print instead of Serial.print due to it using SAMD21 chip. thanks.
// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
#include “DHT.h”
#define DHTPIN 2 // what pin we’re connected to
// Uncomment whatever type you’re using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
Serial.begin(9600);
Serial.println(“DHTxx test!”);
/if using WIO link,must pull up the power pin./
// pinMode(PIN_GROVE_POWER, OUTPUT);
// digitalWrite(PIN_GROVE_POWER, 1);
dht.begin();
}
void loop()
{
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds ‘old’ (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();
// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h))
{
SerialUSB.println(“Failed to read from DHT”);
}
else
{
SerialUSB.print(“Humidity: “);
SerialUSB.print(h);
SerialUSB.print(” %\t”);
SerialUSB.print(“Temperature: “);
SerialUSB.print(t);
SerialUSB.println(” *C”);
}
}
hello, everything is fine with the code but when I try to upload it gives me port error.
Hi there~
- Please change the below serial to serialusb.
</s>Serial.begin(9600);
Serial.println("DHTxx test!");
<e>
- If you can not find the port, you can double tap the reset button. thanks.