C library, Azure Sphere, MT3620 Grove Shield, I2C, Analog, SC18IM700, AD7992, Visual Studio 2017
Switch branches/tags
Nothing to show
Clone or download
Latest commit 31e030e Nov 27, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
MT3620_Grove_Shield_Library Remove .vs folders. Nov 23, 2018
Samples Remove .vs folders. Nov 23, 2018
.gitignore Remove unused files. Nov 23, 2018
LICENSE Initial commit Oct 17, 2018
MT3620_Grove_Shield_Library.sln release: v1.0.0 Oct 17, 2018
README.md typo Nov 23, 2018

README.md

About MT3620 Grove Shield Library

This is library for Azure Sphere MT3620 Grove Shield, the shield enhences Azure Sphere by adding I2C interface and Analog input.

Requirements

Create a MT3620 application with Visual Studio 2017

  1. Open Visual Studio 2017
  2. Select File > New > Project
  3. Select Installed > Visual C++ > Cross Platform > Azure Sphere at the left side

There are some templates for MT3620, select Blank Application for MT3620 RDB (Azure Sphere) to create a blank project, or if you want to use Azure IoT Hub then select Azure IoT Hub Sample for MT3620 RDB(Azure Sphere).

  1. Select Blank Application for MT3620 RDB (Azure Sphere) and type a project name, select a project location then click OK.

Import MT3620_Grove_Shield_Library to the project

  1. Right-Click the solution title In Solution Explorer window on the right side
  2. Select Add > Existing Project
  3. Select MT3620_Grove_Shield_Library > MT3620_Grove_Shield_Library.vcxproj, then click Open
  4. Now MT3620_Grove_Shield_Library has been added to the solution.
  5. Right-Click the project name of your application, select Properties > C/C++ > General > Additional Include Directories
  6. Click the down arraw > Edit... > New Line icons, add the path of MT3620_Grove_Shield_Library to the blank item, click Select Folder > OK > OK
  7. Go to the application project Right-Click References > Add References, select Projects, click the check box of MT3620_Grove_Shield_Library, then click OK
  8. Select app_manifest.json in the application project, add the below attributions, so that we can use the peripherals that MT3620 Grove Shield would use.
"Capabilities": {
	"AllowedConnections": [],
	"Gpio": [ 8, 9, 10, 15, 16, 17, 18, 19, 20, 12, 13, 0, 1, 4, 5, 57, 58, 11, 14, 48 ],
	"Uart": [ "ISU0", "ISU3" ],
	"WifiConfig": false
}
  1. Now you can edit main.c file in Source Files, to include Grove.h and Sensor/xxx.h to drive the MT3620 Grove Shield.

Some available header files

  • Grove.h
  • Sensors/Grove4DigitDisplay.h
  • Sensors/GroveRelay.h
  • Sensors/GroveTempHumiBaroBME280.h
  • Sensors/GroveTempHumiSHT31.h
  • Sensors/GroveAD7992.h
  • Sensors/GroveOledDisplay96x96.h
  • Sensors/GroveRelay.h
  • Sensors/GroveRotaryAngleSensor.h
  • Sensors/GroveLEDButton.h
  • Sensors/GroveLightSensor.h

Usage of the library, see Example - Temp and Huminidy SHT31

  1. Add headers
#include "Grove.h"
#include "Sensors/GroveTempHumiSHT31.h"
  1. Initialize the shield in main() function
int i2cFd;
GroveShield_Initialize(&i2cFd, 115200); // baudrate - 9600,14400,19200,115200,230400 
  1. Initialize and instantiation
void* sht31 = GroveTempHumiSHT31_Open(i2cFd);
  1. Read temp and humidiy from the sensor
GroveTempHumiSHT31_Read(sht31);
float temp = GroveTempHumiSHT31_GetTemperature(sht31);
float humi = GroveTempHumiSHT31_GetHumidity(sht31);