Last active
June 30, 2020 09:40
-
-
Save ElectricImpSampleCode/d9449c65cc4e9019975ef7a7e3df7d62 to your computer and use it in GitHub Desktop.
imp006 Breakout Board Getting Started #2 — Device Code
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
// 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