This file contains 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 azureCognitiveServicesAuthEndpoint = 'https://northeurope.api.cognitive.microsoft.com/sts/v1.0/issueToken'; | |
var azureCognitiveServicesSubscriptionKey = "[...]"; | |
[...] | |
// Azure Cognitive Services interface | |
var _cachedAzureToken = null; | |
var _cachedAzureTokenExpires = null; | |
function azureGetAuthToken(callback) { | |
if (_cachedAzureToken && _cachedAzureTokenExpires) { |
This file contains 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 DeviceClient = require('azure-iot-device').Client | |
var DeviceProtocol = require('azure-iot-device-amqp').AmqpWs | |
[...] | |
var connectionString = "HostName=....."; | |
[...] | |
var client = DeviceClient.fromConnectionString(connectionString, DeviceProtocol); |
This file contains 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 SerialPort = require("serialport"); | |
var tinycolor2 = require("tinycolor2"); | |
var request = require('request'); | |
var portdev = "/dev/ttyACM0"; | |
var port = new SerialPort(portdev, { | |
baudRate: 9600, | |
}); | |
port.on('error', function(err) { |
This file contains 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 SerialPort = require("serialport"); | |
var tinycolor2 = require("tinycolor2"); | |
var request = require('request'); | |
var portdev = "/dev/ttyACM0"; | |
var port = new SerialPort(portdev, { | |
baudRate: 9600, | |
}); | |
port.on('error', function(err) { |
This file contains 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
// Alexa skill handler for the "Citrix" demo skill. | |
// | |
// This runs as an Azure Function and must have the NPM libraries installed into the | |
// Function App image: ensure that package.json is populated with the required | |
// dependencies and follow the instructions at | |
// https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#node-version-and-package-management | |
// | |
// Example package.json: | |
// { | |
// "dependencies": { |
This file contains 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 <Adafruit_NeoPixel.h> | |
#define WS2811_PIN 6 | |
#define WS2811_LED_COUNT 20 | |
// Set to true to flash the LEDs on and off at approx 1Hz | |
boolean flash = false; | |
// The target color for the LED string, indexed by LED number | |
int target_r[WS2811_LED_COUNT]; |
This file contains 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 SerialPort = require("serialport"); | |
var clientFromConnectionString = require('azure-iot-device-amqp').clientFromConnectionString; | |
var tinycolor2 = require("tinycolor2"); | |
var connectionString = "<IoT Hub connection string>"; | |
var portdev = "/dev/ttyACM0"; | |
var port = new SerialPort(portdev, { | |
baudRate: 9600, | |
}); |
This file contains 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 request = require('request'); | |
function jrbHomeAutomation(context, event) { | |
context.log("jrbHomeAutomation event " + JSON.stringify(event)); | |
if ((event.topic) && (event.message)) { | |
switch (event.topic) { | |
case "Alert": | |
request({ | |
url: "<logic app trigger URL>", |
This file contains 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
{ | |
"dependencies": { | |
"azure-iothub": "^1.1.17", | |
"azure-iot-common": "^1.2.0" | |
} | |
} |
This file contains 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 Client = require('azure-iothub').Client; | |
var Message = require('azure-iot-common').Message; | |
function printResultFor(op) { | |
return function printResult(context, err, res) { | |
context.log('printResult for ' + op); | |
if (err) context.log(op + ' error: ' + err.toString()); | |
if (res) context.log(op + ' status: ' + res.constructor.name); | |
if (err) { | |
context.res = { |