Program for IoT Part 2 ⏱
Getting Started with a Web Interface to the IoT Device
Programming a Web-enabled IoT Device
Program the Particle IoT Device
1. Create a new program in Particle build.
2. Connect the temperature and humidity sensor to D2, connect the LED to A4, and connect your Argon device to your computer.
3. Include the "GROVE_TEMPERATURE_AND_HUMIDITY_SENSOR" and "Grove_ChainableLED" libraries in your program as we have done before.
4. Copy and paste the code below (except of the #include parts) into your program.
5. Save, Verify, and Flash the code to the Argon board.
6. Open the Console from particle build, select "my devices", and select your Argon.
7. Get the temp and humidity variables to check if all is working. Call the "toggleLed" function to ensure the light toggles.
Program the Web Interface
1. Create a new replit program for HTML/CSS/JavaScript.
2. Copy and paste the following for your `index.html` file.
3. Copy and paste the following for your `script.js` file.
4. Run your replit.com program.
5. Login to your web app with your Particle account.
6. Confirm that the temperature is displayed on your page.
7. Click the `Toggle Light` button and confirm that the light on your device changes and the text on your web app is consistent with the change.
That's it for our first web-enabled IoT experiment 🎉.
★ If you are having any problems, no worry, post in our slack channel. Please share your code when it makes sense or create videos.
For Reference
Last updated