Difference between revisions of "CSC270 Final Exam 2012"
Line 125: | Line 125: | ||
<br /><source lang="C"> | <br /><source lang="C"> | ||
/* | /* | ||
− | + | Receiver.pde | |
− | + | D. Thiebaut | |
+ | |||
+ | Uses a handshake protocol (STB & ACK) to receive characters sent in 5-bit ASCII to it. | ||
+ | The characters are 'A' to 'Z' and repeat forever. All 26 characters of the alphabet are | ||
+ | sent. | ||
+ | |||
+ | Whenever a character is received, the bits 010 are appended to it to form an 8-bit ASCII. | ||
+ | |||
+ | When 'A' is recognized (hex 41), the receiver activates the on-board LED. When any other | ||
+ | character is received, the LED is turned off. | ||
+ | |||
+ | The program outputs each character to the serial monitor, which must be set to a baud rate | ||
+ | of 115200 baud. | ||
+ | |||
This example code is in the public domain. | This example code is in the public domain. | ||
Line 171: | Line 184: | ||
// set data communication speed | // set data communication speed | ||
− | Serial.begin( 115200 ); | + | Serial.begin( 115200 ); // 115,200 baud, or bits/sec |
// set STB high | // set STB high |