Skip to content

Instantly share code, notes, and snippets.

@ElectricImpSampleCode
Last active June 30, 2020 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElectricImpSampleCode/d9449c65cc4e9019975ef7a7e3df7d62 to your computer and use it in GitHub Desktop.
Save ElectricImpSampleCode/d9449c65cc4e9019975ef7a7e3df7d62 to your computer and use it in GitHub Desktop.
imp006 Breakout Board Getting Started #2 — Device Code
// Set up global variables
// Reference the imp006 pins connected two of the user LED's colors
red_pin <- hardware.pinR;
// Define the LED flash function
function setLed(state) {
// Set the user LED control pins' state
red_pin.write(state ? 1 : 0);
}
// Set up the user LED pins as digital outputs
red_pin.configure(DIGITAL_OUT, 0);
// Register a handler function for incoming "set.led" messages from the agent
agent.on("set.led", setLed);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment