Last active
June 30, 2020 09:38
-
-
Save ElectricImpSampleCode/a3c0761b4e0a7a4e266fac2898930e09 to your computer and use it in GitHub Desktop.
imp006 Breakout Board Getting Started #1
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 pin connected the user LED's blue light | |
blue_pin <- hardware.pinXB; | |
// Track the LED flash state | |
state <- false; | |
// Define the LED flash function | |
function flash() { | |
// Set the user LED control pin's state | |
state = !state; | |
blue_pin.write(state ? 1 : 0); | |
// Call the flash function in 1 second | |
imp.wakeup(1.0, flash); | |
} | |
// Set up the user LED pins as digital outputs | |
blue_pin.configure(DIGITAL_OUT, 0); | |
// Start the LED flash loop | |
flash(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment