Created
October 20, 2016 19:52
-
-
Save pdhixenbaugh/c53dbf4ed518532d77b891cead8fbd9b to your computer and use it in GitHub Desktop.
Loop that gets stuck
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
// Riffle example by pdhixenbaugh | |
// on the Riffle, pin 9 is connected to an on-board LED. | |
const int built_in = 9; //Built-in LED | |
const int hdr_pwr_enable = 8; //enable "3V3" pin for header power | |
// the setup function runs once when you press reset or power the board | |
void setup() { | |
//initialize the built-in LED | |
pinMode(built_in, OUTPUT); | |
// put the 3V3 pin in the right mode, and turn it off | |
pinMode(hdr_pwr_enable, OUTPUT); | |
digitalWrite(hdr_pwr_enable, HIGH); //Turn off power | |
} | |
// the loop function runs over and over again forever | |
void loop() { | |
digitalWrite(built_in, HIGH); // turn the built-in LED on (HIGH is the voltage level) | |
// turn on external power | |
digitalWrite(hdr_pwr_enable, HIGH); //Turn off external power | |
delay(1000); // wait for a second | |
digitalWrite(built_in, LOW); // turn the built-in LED off by making the voltage LOW | |
// turn off external power | |
digitalWrite(hdr_pwr_enable, LOW); //Turn on external power | |
delay(3000); // wait for three seconds in "off" mode | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment