This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "globals":[ | |
| { | |
| "key":"onMessageFinishedUrl", | |
| "type":"string" | |
| }, | |
| { | |
| "key":"doorResponseUrl", | |
| "type":"string" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var https = require('https'); | |
| exports.handler = (event, context, callback) => { | |
| var postData = JSON.stringify(event); | |
| var options = { | |
| hostname: 'triggers.losant.com', | |
| port: 443, | |
| path: '/webhooks/my-webhook-id', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| #include "WiFi.h" | |
| // WiFi credentials. | |
| const char* WIFI_SSID = "wifi-ssid"; | |
| const char* WIFI_PASS = "wifi-password"; | |
| void setup() | |
| { | |
| Serial.begin(9600); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Example for periodically sending temperature data. | |
| * | |
| * Copyright (c) 2016 Losant IoT. All rights reserved. | |
| * https://www.losant.com | |
| */ | |
| #include <ESP8266WiFi.h> | |
| #include <Losant.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Reads the value of the moisture sensor | |
| * and sends the value to Losant. | |
| */ | |
| void reportMoisture() { | |
| // Turn on the moisture sensor. | |
| // The sensor will corrode very quickly with current | |
| // running through it all the time. We just need to send | |
| // current through it long enough to read the value. | |
| digitalWrite(MOISTURE_PIN, HIGH); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function formatDate(dateVal) { | |
| var newDate = new Date(dateVal); | |
| var sMonth = padValue(newDate.getMonth() + 1); | |
| var sDay = padValue(newDate.getDate()); | |
| var sYear = newDate.getFullYear().toString().substring(2,4); | |
| var sHour = newDate.getHours(); | |
| var sMinute = padValue(newDate.getMinutes()); | |
| var sAMPM = "AM"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Load the SDK | |
| const AWS = require('aws-sdk') | |
| const Stream = require('stream') | |
| const Speaker = require('speaker') | |
| var five = require("johnny-five"), | |
| board, button | |
| var Raspi = require("raspi-io") | |
| var board = new five.Board({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Load the SDK | |
| const AWS = require('aws-sdk') | |
| const Stream = require('stream') | |
| const Speaker = require('speaker') | |
| var five = require('johnny-five'), | |
| board, button | |
| var Raspi = require('raspi-io') | |
| var board = new five.Board({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var five = require('johnny-five'); | |
| var raspi = require('raspi-io'); | |
| var Device = require('losant-mqtt').Device; | |
| // Construct Losant device. | |
| var device = new Device({ | |
| id: 'my-device-id', // Need to replace with Device ID from Losant | |
| key: 'my-access-key', // Need to replace with Access Key from Losant | |
| secret: 'my-access-secret' // Need to replace with Access Secret from Losant | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Example for reading temperature and humidity | |
| * using the DHT22 and ESP8266 | |
| * | |
| * Copyright (c) 2016 Losant IoT. All rights reserved. | |
| * https://www.losant.com | |
| */ | |
| #include "DHT.h" |