Software apps and online services
The Azure Sphere Dev Kit MT3620 is a board that is certified into the Azure Sphere platform. This means that this board and the microcontroller has many security requisites that the platform require. You can learn more about Azure Sphere platform in this site: https://docs.microsoft.com/en-us/azure-sphere/
This tutorial is the first simple example how use the Azure Sphere Dev Kit to read the status of a push button connected to a GPIO.
The connection are so simple, we are using the Pull Up method to read the value on the GPIO.
On this picture you can find the GPIO5 and 3.3v port localization.
The first step is to open the Visual Studio 2017 and create a new project.
On the wizard screen, select the project type Azure Sphere and select Blank Application for MT3620 RDB (Azure Sphere) type.
The Visual Studio will open like this example code.
The next thing we need to do is request to the Azure Sphere platform the authorization to use the GPIO5. To do this we need to change the app_manifest.json put the number five into the Gpio propertie.
We need to change the main.c code, to create an static variable call gpio, than into the main function we use the GPIO_OpenAsInput() to get the reference to the MT3620_GPIO5. Into the while block we use the GPIO_GetValue() to read the port value and the output parameter newState will receve this new value. Finally we use the Log_Debug to write the value into the console window. Connect your MT3620 kit and press F5 to run the code.
You can see on the output window, that the value change when you press the push button.
This code is in the repository: https://github.com/waltercoan/Mt3620GPIORead