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
//Header files - Start// | |
#include "AZ3166WiFi.h" | |
#include "AzureIotHub.h" | |
#include "DevKitMQTTClient.h" | |
#include "config.h" | |
#include "utility.h" | |
#include "SystemTickCounter.h" | |
#include "RingBuffer.h" | |
#include "parson.h" | |
#include "EEPROMInterface.h" |
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
//Constants and variables- Start// | |
enum AppState | |
{ | |
APPSTATE_Init, | |
APPSTATE_Error, | |
APPSTATE_Recording | |
}; | |
static AppState appstate; | |
// These numbers need to match the compiled ELL models. |
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
//Configuration functions - Start// | |
static void initWifi() | |
{ | |
Screen.print(2, "Connecting..."); | |
if (WiFi.begin() == WL_CONNECTED) | |
{ | |
IPAddress ip = WiFi.localIP(); | |
Screen.print(1, ip.get_address()); | |
hasWifi = true; |
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
void setup() | |
{ | |
Screen.init(); | |
Screen.print(0, "IoT Device Demo"); | |
Screen.print(2, "Initializing..."); | |
Screen.print(3, " > Serial"); | |
Serial.begin(115200); | |
// Initialize the WiFi module |
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
// Copyright (c) Microsoft. All rights reserved. | |
// Licensed under the MIT license. | |
// Interval time(ms) for sending message to IoT Hub | |
#define INTERVAL 5000 | |
#define MESSAGE_MAX_LEN 256 | |
#define TEMPERATURE_ALERT 30 |
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
void loop() | |
{ | |
if (hasWifi) | |
{ | |
if (messageSending && (int)(SystemTickCounterRead() - send_interval_ms) >= getInterval()) | |
{ | |
if (appstate != APPSTATE_Error) | |
{ | |
if (dropped_frames > 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
// Copyright (c) Microsoft. All rights reserved. | |
// Licensed under the MIT license. | |
#include "HTS221Sensor.h" | |
#include "AzureIotHub.h" | |
#include "Arduino.h" | |
#include "parson.h" | |
#include <assert.h> | |
#include "config.h" | |
#include "RGB_LED.h" |
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
{ | |
"messageId": 119, | |
"decibels": 94, | |
"temperature": 26.4, | |
"humidity": 34.400002, | |
"pressure": 994.585693, | |
"accelX": -9, | |
"accelY": -12, | |
"accelZ": 993, | |
"magX": -156, |
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
pragma solidity >=0.4.22 <0.6.0; | |
contract owned { | |
address public owner; | |
constructor() public { | |
owner = msg.sender; | |
} | |
modifier onlyOwner { |
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
npm install -g @angular/cli |