Blink Example for LaunchPad(MSP430) & Stellaris LaunchPad by Energia
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
| // LaunchPad(MSP430G2231),StellarisLaunchPad(LM4F120) | |
| // | |
| void setup() { | |
| // initialize the digital pin as an output. | |
| // Pin 14 has an LED connected on most Arduino boards: | |
| pinMode(RED_LED, OUTPUT); | |
| pinMode(GREEN_LED, OUTPUT); | |
| pinMode(PUSH2, INPUT); | |
| } | |
| int tg=0; | |
| int a,b; | |
| void loop() { | |
| if (tg==0) { | |
| digitalWrite(RED_LED, HIGH); | |
| digitalWrite(GREEN_LED, LOW); | |
| } else { | |
| digitalWrite(RED_LED, LOW); | |
| digitalWrite(GREEN_LED, HIGH); | |
| } | |
| a=digitalRead(PUSH2); | |
| delay(50); | |
| b=digitalRead(PUSH2); | |
| if (a==0&&b==0) { | |
| tg=!tg; | |
| } | |
| delay(100); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment