Faas: Dropbox™ Like Simplicity for Intel Edison APIs
by faas in Circuits > Microcontrollers
1109 Views, 7 Favorites, 0 Comments
Faas: Dropbox™ Like Simplicity for Intel Edison APIs
We had recently participated in an Intel Roadshow Hackathon held in Redwood City, California, and our team had worked on creating a very cool app using Ionic Framework, that provides a detailed information to connect and control the Intel Edison Module remotely and securely using our Faas Cloud Service.
Connect Intel Edison Module With Grove Shield
Please follow the detailed instructions below to getting started with your Intel Edison Module.
Sign Up for a Faas Developer Account
You should be a valid Faas developer to use the Faas Cloud Service, so please go ahead and sign up a new account at faas.io. You can request an invitation code by entering your email address and then you'll receive an email shortly with an activated account and instructions to access the API Keys. With a valid Faas developer account, once you are logged into Faas website, you will land on the faas dashboard page where you can find your API Keys.
Tap on the "Write a secure API now!" button to see the complete instructions to getting started with Faas.
Install and Configure the Faas Agent
Once the Intel Edison is configured with wifi then you can install the Faas agent npm module and start adding your apis.
$ npm install faas
Create a folder for your apis, and create your first api.
$ mkdir my-apis $ touch my-apis/edison.js
Edit the edison.js file
$ vi my-apis/edison.js
and add the following content:
// include the io library var mraa = require('mraa'); // connect the led module to digital pin 2 var led = new mraa.Gpio(2); // set the led pin to output led.dir(mraa.DIR_OUT); // api to turn on the led exports.ledOn = function(cb) { led.write(1); cb(null, { 'status': 'on' }); } // api to turn off the led exports.ledOff = function(cb) { led.write(0); cb(null, { 'status': 'off' }); }
Create a script file and give execute permission to run the faas agent.
$ touch faas-agent.sh $ chmod u+x faas-agent.sh
Edit the faas-agent.sh file
$ vi faas-agent.sh
add the following content:
#!/bin/sh export NODE_PATH=/usr/lib/node_modules export FAAS_API_KEY=your key export FAAS_API_SECRET=your secret export FAAS_IX_API_DIR=my-apis ./node_modules/faas/bin/faas-ix-server
replace "your key" and "your secret" with relevant key and secret from your faas.io account.
Run the faas agent
$ ./faas-agent.sh
Getting Started With Mobile App
You need to have Ionic Framework installed in your computer to run the app from your computer browser or install directly on your mobile device.
Once you have installed the Ionic Framework, clone the app source code from our github repository.
$ git clone https://github.com/faas/faas-edison-instructable.git
Change your current directory to "faas-edison-instructable" and run the app.
$ cd faas-edison-instructable $ ionic serve
To run the app from ios emulator
$ ionic emulate ios
To install and run the app from device
$ ionic run ios
Conclusion
With Faas, you get the most easy API publishing solution on Intel Edison. It provides you with a secure pipeline all the way to your device. The speed at which you can build code to interact with Edison is incomparable to anything else. You get the ability to deliver the functionality of your IoT device in a matter of minutes. This simplicity of secure web API publishing is comparable with Dropbox™ for online backups.
Check out more and get your own account at https://www.faas.io.