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":"phone", | |
| "type":"string" | |
| }, | |
| { | |
| "key":"slackUrl", | |
| "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
| #include <LiquidCrystal_I2C.h> | |
| // Construct an LCD object and pass it the | |
| // I2C address, width (in characters) and | |
| // height (in characters). Depending on the | |
| // Actual device, the IC2 address may change. | |
| LiquidCrystal_I2C lcd(0x3F, 16, 2); | |
| void setup() { |
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
| # For debugging | |
| log_type all | |
| # Bridge to Losant | |
| connection bridge-to-losant | |
| address broker.losant.com:8883 | |
| bridge_cafile /path/to/losant/LosantRootCA.crt | |
| cleansession true | |
| try_private false | |
| bridge_attempt_unsubscribe false |
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
| // This function node combines all of the async values | |
| // reported by the sensor tag node into a single | |
| // payload. The flow will only continue when all values | |
| // have been received. | |
| var payload = context.get('payload') || { data: {} }; | |
| // Number of total attributes to report. | |
| // When we collect all attributes from the | |
| // sensor tag, the flow will continue. |
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
| /* | |
| Insert this code in your "Losant REST" PubNub Event Handler. | |
| Make sure the channel name is "losant_rest" | |
| */ | |
| export default (request) => { | |
| // we need this module to make our requests to the Losant API | |
| const xhr = require('xhr'); | |
| // put all connection credentials here |
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
| Class TempLogger | |
| // Device ID of Peripheral in Losant | |
| Const LosantDeivceId As String = "57d85157f3894e01006c6afa" | |
| // MQTT topic in Losant | |
| Const LosantTopic As String = "losant/" + LosantDeivceId + "/state" | |
| Shared Event CheckTemp() RaiseEvent Every 30 Seconds | |
| Dim temp As Float = TempSensor.GetTemp() // Get Temp from sensor | |
| Dim tempstring As String = temp.ToString() |
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
| Class test | |
| Shared Event RedLed() RaiseEvent Every 500 milliSeconds | |
| LedRed = Not LedRed | |
| End Event | |
| End Class |
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 interval = 1000 | |
| var isLedOn = false | |
| var lightThreshold = 0.7 | |
| // Initilize the LED to be off | |
| digitalWrite(D5, false) | |
| setInterval(function() { | |
| console.log("Light Level: " + analogRead()) |