With the latest release of Azure IoT Toolkit, lots of popular languages are supported to quickly create an Azure IoT application in VS Code: C#, Go, Java, Node.js, PHP, Python and Ruby! (Note: For C#, Java, Node.js and Python, it is based on Azure IoT Hub SDK, while for Go, PHP and Ruby, it is based on Azure IoT Hub REST API.) What’s your favorite programing language? Which language would you like to develop an Azure IoT application?
For scripting languages (Go, Node.js, PHP, Python and Ruby), the steps are pretty easy, you could follow this blog post to quickly make that.
For compiled language (C# and Java), there is one more step compared with the scripting languages, but it is still easy. Let’s see how easy it is to create a Java application for Azure IoT Hub in VS Code.
Prerequisites
- If you do not have an IoT Hub, you could follow our tutorial to create IoT Hub and device.
- Azure IoT Toolkit extension to help you do all the things when develop with Azure IoT Hub.
- Java Extension Pack
Generate Code
- Right-click your device and select Generate Code to monitor the device-to-cloud message
- In language list, select Java
- In code template list, select Send device-to-cloud message
- In pop-up file dialog, select the folder for your Java application
- A new VS Code window will open
Run Code
- Open Integrated Terminal of VS Code
- Run mvn clean package to install the required libraries and build the simulated device application
- Run java -jar target/simulated-device-1.0.0-with-deps.jar to run the simulated device application
- You will see the Java application is running. It is sending the simulated device data to IoT Hub every second.
- If you want to monitor the device-to-cloud message in VS Code, you could refer to our Wiki page.
If your preferred language is not supported yet, no worry! You could just submit your request in GitHub, or use the REST API to build your application. Let us know what languages you want! Feel free to leave your feedback or suggestion in our GitHub issue !
Useful Resources:
- Channel 9 video: Walkthrough of Azure IoT Toolkit extension
- Create an IoT hub using the Azure IoT Toolkit for Visual Studio Code
- Use Azure IoT Toolkit to send and receive messages between your device and IoT Hub
- Use Azure IoT Toolkit for Azure IoT Hub device management
- Use VS Code as IoT Hub Device Simulator
- Use VS Code to call Azure IoT Hub REST APIs
- Create and control an IoT device connected to an IoT hub (Node.js)
- Create and control an IoT device connected to an IoT hub (.NET)
- Handy Tool When You Develop With Azure IoT
- Azure IoT Toolkit for Visual Studio Code generally available for managing Azure IoT Hub and Devices with ease
0 comments