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
// AGENT CODE | |
const AMPLITUDE = 0x3FFF; | |
const NUMBER_POINTS = 1024; | |
const CLIP_VALUE = 32635; | |
const INCR_X = 0.78531475; | |
local streaming = false; | |
local logTable = [ | |
1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | |
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, |
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
// Get GSV (satellites in view) NMEA sentences from modem | |
// NOTE #1 See https://gpsd.gitlab.io/gpsd/NMEA.html#_nmea_standard_sentences | |
// for sentence details | |
// NOTE #2 Assumes you have an existing configured and enabled gnss-session | |
// instance, as per https://developer.electricimp.com/api/gnss-session/enable | |
// Callback to process read sentences | |
function processSentences(result) { | |
if (result.status == 0) { | |
// No error, so just output each received sentence, |
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
// ------------------------------------------------------------------------------ | |
// File: factory.activation.dut.agent.nut | |
// Version: 2.1.2 | |
// | |
// Copyright 2020 Twilio | |
// | |
// SPDX-License-Identifier: MIT | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal |
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
/* | |
* Demonstrate pulse counting using an imp UART | |
* | |
* This code uses the falling edge of the input signal to trigger a UART receive. | |
* A framing error will be generated, but we ignore this - and the data - | |
* and just use the event information. | |
* | |
* Copyright 2020, Twilio. | |
* | |
*/ |
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
/* | |
* Electric Imp Wake Pin example code | |
* | |
* Requires any imp (but not relevant to imp005) | |
* | |
* Copyright 2020 Twilio | |
* License: MIT | |
* | |
*/ |
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
// Updated: 14 July 2020 | |
// IMPORTS | |
#require "rocky.agent.lib.nut:3.0.0" | |
// CONSTANTS | |
const HTML_STRING = @"<!DOCTYPE html><html lang='en-US'><meta charset='UTF-8'> | |
<html> | |
<head> | |
<title>Environment Data</title> | |
<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css' integrity='sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk' crossorigin='anonymous'> |
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
// Register an handler to deal with incoming 'trigger' | |
// messsages from the device -- it just logs the event | |
device.on("trigger", function(isCut) { | |
if (isCut) server.log("Beam cut"); | |
}); |
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
// ------------------------------------------------------------------------------ | |
// File: factory.firmware.dut.agent.nut | |
// Version: 2.1.1 | |
// | |
// Copyright 2020 Twilio | |
// | |
// SPDX-License-Identifier: MIT | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal |
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
// *************************************** | |
// ***** SETUP ***** | |
// *************************************** | |
// CONSTANTS | |
// Replace the following string with your server logging endpoint | |
const RESULTS_URL = "YOUR_RESULT_LOGGING_URL"; | |
// *************************************** | |
// ***** DUT AGENT FUNCTIONS ***** |
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
// IMPORTS | |
// Get the temperature sensor library | |
#require "HTS221.device.lib.nut:2.0.2" | |
// CLASSES | |
// The following driver class and enum provides support | |
// for the TM1637 display chip | |
enum TM1637_LED_CLASS { | |
ADDR_AUTO = 0x40, | |
CMD_SET_ADDR = 0xC0, |