The minimal Azure Sphere app prints the MAC and IP address of the given network interface.
The app uses the following Azure Sphere libraries.
Library | Purpose |
---|---|
log.h | Contains functions that log debug messages. |
File/folder | Description |
---|---|
File/folder | Description |
--------------------- | ------------- |
app_manifest.json |
Application manifest file, which describes the resources. |
CMakeLists.txt |
CMake configuration file, which Contains the project information and is required for all builds. |
CMakeSettings.json |
JSON file for configuring Visual Studio to use CMake with the correct command-line options. |
launch.vs.json |
JSON file that tells Visual Studio how to deploy and debug the application. |
LICENSE.txt |
The license for this project. |
main.c |
Main C source code file. |
README.md |
This README file. |
.vscode |
Folder containing the JSON files that configure Visual Studio Code for building, debugging, and deploying the application. |
This sample requires the following hardware:
-
Ensure that your Azure Sphere device is connected to your computer and your computer is connected to the internet.
-
Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.07 or above. At the command prompt, run azsphere show-version to check. Upgrade the Azure Sphere SDK for Windows or Linux as needed.
-
Enable application development, if you have not already done so, by entering the following line at the command prompt:
azsphere device enable-development
-
Configure networking on your device. You must either set up WiFi or set up Ethernet on your development board, depending on the type of network connection you are using.
When the app is run, by default the app will print the MAC and IP address of the WiFi interface.
To change the interface to ethernet, search for the line static const char networkInterface[] = "wlan0";
and change it to static const char networkInterface[] = "eth0";
, compile and run the app.
There is no official support guarantee for this code, but we will make a best effort to respond to/address any issues you encounter.
If you run into an issue with this code, please open a GitHub issue against this repo.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
For details on license, see LICENSE.txt in this directory.