This is library for Azure Sphere MT3620 Grove Shield, the shield enhences Azure Sphere by adding I2C interface and Analog input.
- Operation System - Final version of Windows 10
- Visual Studio 2017 Community/Professional/Enterprise
- Azure Sphere SDK Preview for Visual Studio
- Hardware - Azure Sphere, MT3620 Grove Shield
- Open Visual Studio 2017
- Select File > New > Project
- 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).
- Select Blank Application for MT3620 RDB (Azure Sphere) and type a project name, select a project location then click OK.
- Right-Click the solution title In Solution Explorer window on the right side
- Select Add > Existing Project
- Select MT3620_Grove_Shield_Library > MT3620_Grove_Shield_Library.vcxproj, then click Open
- Now MT3620_Grove_Shield_Library has been added to the solution.
- Right-Click the project name of your application, select Properties > C/C++ > General > Additional Include Directories
- 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
- Go to the application project Right-Click References > Add References, select Projets, click the check box of MT3620_Grove_Shield_Library, then click OK
- 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
}
- Now you can edit main.c file in Source Files, to include Grove.h and Sensor/xxx.h to drive the MT3620 Grove Shield.
- 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
- Add headers
#include "Grove.h"
#include "Sensors/GroveTempHumiSHT31.h"
- Initialize the shield in main() function
int i2cFd;
GroveShield_Initialize(&i2cFd, 115200); // baudrate - 9600,14400,19200,115200,230400
- Initialize and instantiation
void* sht31 = GroveTempHumiSHT31_Open(i2cFd);
- Read temp and humidiy from the sensor
GroveTempHumiSHT31_Read(sht31);
float temp = GroveTempHumiSHT31_GetTemperature(sht31);
float humi = GroveTempHumiSHT31_GetHumidity(sht31);