Doorbells are so pre-IoT, let's make a way to connect our phone to our Pinoccio with the power of Node.js, Pinoccio, and Twilio.
Alright to get started you're gonna need to create a Twilio accout, it's super easy, and they give you $30 worth of texting and calling for free, and their api is super easy since they have wrappers for almost any language. Get started with Twilio at http://www.twilio.com.
Follow their instructions to find your sid and auth token on their node.js library documentation.
Now we can move onto the Node.js app, open up a terminal create a directory for the app to live. Run:
npm init
to set up your app. Now run:
npm install --save twilio pinoccio
to install all the necessary modules needed for our app.
The following code will allow you to read data from the Pinoccio Scout and also send a text message to you cell phone. Save the following code as index.js in your project folder.
This code is reading the pin "d2" from your first scout. That's it for the code. The setup for the board is below, it's pretty straight forward a button connected to pin "d2".
Now after you set up the board, you can run
node index
and this will start up a node server receiving data from your pinoccio scout, and if you press the button, the server will send a text message to your phone.
Comments
Please log in or sign up to comment.