Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Autoflight2018_22_MODSERIAL
Fork of MODSERIAL by
Diff: example1.cpp
- Revision:
- 28:76793a84f9e5
- Parent:
- 27:9c93ce7cb9d8
--- a/example1.cpp Thu Jul 11 13:34:53 2013 +0000
+++ b/example1.cpp Fri Jul 12 15:27:07 2013 +0000
@@ -10,7 +10,7 @@
DigitalOut led1(LED1);
DigitalOut led2(LED2);
-DigitalOut led3(LED2);
+DigitalOut led3(LED3);
DigitalOut led4(LED4);
MODSERIAL pc(USBTX, USBRX);
@@ -57,7 +57,7 @@
pc.baud(PC_BAUD);
// Use a deliberatly slow baud to fill up the TX buffer
- uart.baud(300);
+ uart.baud(1200);
uart.attach(&txCallback, MODSERIAL::TxIrq);
uart.attach(&rxCallback, MODSERIAL::RxIrq);
@@ -68,19 +68,18 @@
led1 = 1; // Show start of sending with LED1.
- for (int loop = 0; loop < 2; loop++) {
+ for (int loop = 0; loop < 512; loop++) {
uart.printf("%c", c);
c++;
if (c > 'Z') c = 'A';
}
- pc.printf("%c", '!');
+
led1 = 0; // Show the end of sending by switching off LED1.
// End program. Flash LED4. Notice how LED 2 and 3 continue
// to flash for a short period while the interrupt system
// continues to send the characters left in the TX buffer.
- wait(2);
- pc.printf("\n\n\r%02X", UART2->C2);
+
while(1) {
led4 = !led4;
wait(0.25);
