Created
December 1, 2015 05:25
-
-
Save NickCarneiro/d247461237b9858eb244 to your computer and use it in GitHub Desktop.
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
#include <msp430g2231.h> | |
/** Delay function. **/ | |
delay() { | |
__delay_cycles(250000); | |
} | |
int main(void) { | |
int i; | |
WDTCTL = WDTPW | WDTHOLD; | |
// turn on red and green for writing | |
// 0b 0100 0001 | |
P1DIR = 0x41; | |
while (1) { | |
for (i = 0 ; i<4 ; i++) { | |
// get values from table | |
// 0 = off , 1 = red , 64 = green , 65 = both | |
// 0 0 0 0 0 0 0 | |
P1OUT = 0x01; | |
delay(); | |
P1OUT = 0x00; | |
delay(); | |
P1OUT = 0x64; | |
delay(); | |
P1OUT = 0x00; | |
delay(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment