Hi,
I am testing the Grove_UartGpio2cAnalog example but I am not able to run it. Any suggestion?
I have a temperature and humidity sensor connected to the i2c port.
UPDATE:
I am now able to read in the Serial Monitor but now I don’t know how to get the values from the sensor in i2c.
I am totally new to arduino.
Best regards!
Gonçalo
Hi there,
I have tried with Wio LTE Cat.1 and Grove - I2C High Accuracy Temp&Humi, here is the code:
[code]
#include “Seeed_SHT35.h”
#include “WioLTEforArduino.h”
#define SDAPIN 20
#define SCLPIN 21
#define RSTPIN 7
#define SERIAL SerialUSB
SHT35 sensor(SCLPIN);
WioLTE wio;
void setup()
{
delay(200);
SerialUSB.println("### I/O Initialize.");
wio.Init();
SerialUSB.println("### Power supply ON.");
wio.PowerSupplyGrove(true);
delay(500);
SERIAL.begin(115200);
delay(10);
SERIAL.println("serial start!!");
if(sensor.init())
{
SERIAL.println("sensor init failed!!!");
}
delay(1000);
}
void loop()
{
u16 value=0;
u8 data[6]={0};
float temp,hum;
if(NO_ERROR!=sensor.read_meas_data_single_shot(HIGH_REP_WITH_STRCH,&temp,&hum))
{
SERIAL.println(“read temp failed!!”);
SERIAL.println(" “);
SERIAL.println(” “);
SERIAL.println(” ");
}
else
{
SERIAL.println(“result======>”);
SERIAL.print(“temperature =”);
SERIAL.println(temp);
SERIAL.print("humidity =");
SERIAL.println(hum);
SERIAL.println(" ");
SERIAL.println(" ");
SERIAL.println(" ");
}
delay(1000);
}
[/code]
Wio have some places are difference to Arduio, such as:
- If you want to use Groves with Wio, add head file WioLTEforArduino.h to your code, create as instance to WioLTE, and add following code to setup() function:
</s><i> </i>delay(200); SerialUSB.println("### I/O Initialize."); wio.Init(); SerialUSB.println("### Power supply ON."); wio.PowerSupplyGrove(true); delay(500); <e>
It will open power supply to Groves;
- Use SerialUSB instead of Serial.
Please try again and tell me about the result.
Best Regards,
Blu