This is a demo project used to programmatically interact with an Arduino IoT device and deploy the NodeJs application to Heroku.
It's intended to be a primer for the following software:
- Arduino iot-js, used to subscribe to the mqtt broker and being able to read and send data
- Arduino iot-api JS client, used to interrogate Arduino IoT cloud endpoints
- Heroku CLI, used to run the node application locally and deploy it in the cloud
- Node.js version 12 (LTS)
-
Install npm dependencies
npm i
-
Create a
.env
file in the project root. IOT_CLIENT_ID and IOT_CLIENT_SECRET can be generated in the Arduino IoT Cloud. THING_ID is both in the sketch file and in the Arduino IoT CloudIOT_CLIENT_ID=<arduino iot key> IOT_CLIENT_SECRET=<arduino iot secret> THING_ID=<the id of the thing to connect with>
-
Setup Heroku
- Create an account if you don't have one
- Install Heroku CLI
- login running
heroku login
in your shell - run
heroku create
in the project root directory
-
Run your app locally on
http://localhost:3000
- via
heroku local
- with the provided launch configuration if you are using VSCode
- via
npm start
- via