Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Electric Imp Quick Start Device Code for GroveStreams
- // A full "how to" guide for this device can be found at https://www.grovestreams.com/developers/getting_started_elec_imp_quick.html
- //
- // License:
- // Copyright 2014 GroveStreams LLC.
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- function readData(){
- server.log("Sending data to Imp Cloud Agent");
- //Gather and pass the data to the Electric Imp Agent running in the cloud
- local data = { id = hardware.getimpeeid(), mac = imp.getmacaddress(), rssi = imp.rssi(),
- voltage = hardware.voltage(), light = hardware.lightlevel()}
- agent.send("GroveStreams", data);
- imp.wakeup(20, readData); //Wakeup every 20 second and read data. Change this value to change your sample frequency.
- }
- //Begin executing program
- readData();
Add Comment
Please, Sign In to add comment