A simple program to test the functionality of Mbed serial pins.
Dependencies: mbed
Fork of Serial_test by
This code was inspired by the issues I faced with my Mbed. I had inadvertently blown up on of the serial ports, so I wrote this simple echo program. Just connect the serial output to the input and run the program. You should see messages appear on the serial terminal of your screen, diagnosing your issues.
main.cpp@0:e148303bda4f, 2015-06-24 (annotated)
- Committer:
- melmon
- Date:
- Wed Jun 24 10:26:25 2015 +0000
- Revision:
- 0:e148303bda4f
Initial Release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
melmon | 0:e148303bda4f | 1 | #include "mbed.h" |
melmon | 0:e148303bda4f | 2 | /* |
melmon | 0:e148303bda4f | 3 | To use, make sure that you have a connection between your serial port tx and rx pins |
melmon | 0:e148303bda4f | 4 | */ |
melmon | 0:e148303bda4f | 5 | Serial pc(USBTX, USBRX); |
melmon | 0:e148303bda4f | 6 | Serial loop1(p9, p10); |
melmon | 0:e148303bda4f | 7 | Serial loop2(p13, p14); |
melmon | 0:e148303bda4f | 8 | |
melmon | 0:e148303bda4f | 9 | int main() { |
melmon | 0:e148303bda4f | 10 | pc.printf("You Should see a message about the port below: \n\r"); |
melmon | 0:e148303bda4f | 11 | loop1.printf("Serial Port 1 Works \n\r"); |
melmon | 0:e148303bda4f | 12 | loop2.printf("Serial Port 2 Works \n\r"); |
melmon | 0:e148303bda4f | 13 | while(1) { |
melmon | 0:e148303bda4f | 14 | //pc.putc(loop1.getc()); |
melmon | 0:e148303bda4f | 15 | pc.putc(loop1.getc()); |
melmon | 0:e148303bda4f | 16 | |
melmon | 0:e148303bda4f | 17 | |
melmon | 0:e148303bda4f | 18 | |
melmon | 0:e148303bda4f | 19 | |
melmon | 0:e148303bda4f | 20 | |
melmon | 0:e148303bda4f | 21 | } |
melmon | 0:e148303bda4f | 22 | } |