Page 1 of 1

Wio Lte M1/NB-IoT + Grove_UartGpio2cAnalog

Posted: Wed Oct 03, 2018 12:16 am
by goncalo-c-machado
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

Re: Wio Lte M1/NB-IoT + Grove_UartGpio2cAnalog

Posted: Tue Dec 18, 2018 5:38 pm
by xianning.lan
Hi there,
I have tried with Wio LTE Cat.1 and Grove - I2C High Accuracy Temp&Humi, here is the code:

Code: Select all

#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);
}
Wio have some places are difference to Arduio, such as:
1. 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:

Code: Select all

delay(200);
SerialUSB.println("### I/O Initialize.");
wio.Init();
SerialUSB.println("### Power supply ON.");
wio.PowerSupplyGrove(true);
delay(500);
It will open power supply to Groves;
2. Use SerialUSB instead of Serial.
Please try again and tell me about the result.
Best Regards,
Blu