Difference between revisions of "CSC270 Final Exam 2012"
Line 57: | Line 57: | ||
int READY_TO_START = 0; | int READY_TO_START = 0; | ||
+ | int SENDING = 1; | ||
char ch = 'A'; | char ch = 'A'; | ||
int state = -1; // uninitialized | int state = -1; // uninitialized | ||
Line 99: | Line 100: | ||
return; | return; | ||
+ | state = SENDING; | ||
+ | |||
// if character we're about to send is 'A' turn LED on | // if character we're about to send is 'A' turn LED on | ||
if ( ch == 'A' ) | if ( ch == 'A' ) | ||
Line 125: | Line 128: | ||
// wait 1/2 second before sending new char | // wait 1/2 second before sending new char | ||
− | delay( | + | delay( 500 ); |
+ | |||
+ | // next char in alphabet | ||
+ | ch = ch + 1; | ||
+ | if ( ch > 'Z' ) ch = 'A'; | ||
+ | |||
state = READY_TO_START; | state = READY_TO_START; | ||
} | } |