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 <SPI.h> | |
#include <WiFi101.h> | |
unsigned long lastConnectionTime = 0; | |
const unsigned long pollingInterval = 2L * 1000L; // 5 sec polling delay, in milliseconds | |
// Generate SAS key using https://github.com/Azure/azure-iot-sdks/releases |
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
// Define the Model | |
BEGIN_NAMESPACE(IoTSample); | |
DECLARE_MODEL | |
(LightSensorDataModel, | |
WITH_DATA(ascii_char_ptr, deviceId), | |
WITH_DATA(int, iotdata), | |
WITH_ACTION(DuckAction, int, light) | |
); | |
END_NAMESPACE(IoTSample); |
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
using System.Net; | |
using Microsoft.Azure.Devices; | |
using Microsoft.Azure.Devices.Common.Security; | |
using System.Globalization; | |
using System.Security.Cryptography; | |
using System.Text; | |
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log) | |
{ | |
string deviceid = req.GetQueryNameValuePairs() |
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
#r "System.Configuration" | |
#r "System.Data" | |
#r "Newtonsoft.Json" | |
using System; | |
using System.Configuration; | |
using System.Data.SqlClient; | |
using System.Threading.Tasks; | |
using System.Net; | |
using Newtonsoft.Json; |
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
// based on https://electronicsinnovation.com/how-to-connect-nodemcu-esp8266-with-aws-iot-core-using-arduino-ide-mqtt/ | |
// install https://github.com/esp8266/arduino-esp8266fs-plugin and upload certificates | |
#include "FS.h" | |
#include <ESP8266WiFi.h> | |
#include <PubSubClient.h> | |
#include <NTPClient.h> | |
#include <WiFiUdp.h> | |
// Update these with values suitable for your network. |
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
#r "System.Configuration" | |
#r "System.Data" | |
#r "System.Data.SqlClient" | |
#r "Newtonsoft.Json" | |
using System; | |
using System.Configuration; | |
using System.Data.SqlClient; | |
using System.Threading.Tasks; | |
using System.Net; |