![](/media/cache/profiles/17a98ed636b0294602e63e75d11339a2.jpg.50x50_q85.jpg)
a simple uart (printf) test program
main.cpp@0:48b5be00cf5e, 2018-06-17 (annotated)
- Committer:
- poushen
- Date:
- Sun Jun 17 06:37:37 2018 +0000
- Revision:
- 0:48b5be00cf5e
a simple uart (printf) test program.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
poushen | 0:48b5be00cf5e | 1 | #include "mbed.h" |
poushen | 0:48b5be00cf5e | 2 | |
poushen | 0:48b5be00cf5e | 3 | DigitalOut myled(LED2); |
poushen | 0:48b5be00cf5e | 4 | |
poushen | 0:48b5be00cf5e | 5 | // for LPCXpresso LPC1114 board |
poushen | 0:48b5be00cf5e | 6 | // UART TX: xp9, dp16 |
poushen | 0:48b5be00cf5e | 7 | // UART RX: xp10, dp15 |
poushen | 0:48b5be00cf5e | 8 | // ************************************* |
poushen | 0:48b5be00cf5e | 9 | // ** serial port: 9600, 8, N, 1, N |
poushen | 0:48b5be00cf5e | 10 | // ************************************* |
poushen | 0:48b5be00cf5e | 11 | //Serial pc(xp9, xp10); |
poushen | 0:48b5be00cf5e | 12 | |
poushen | 0:48b5be00cf5e | 13 | int main() { |
poushen | 0:48b5be00cf5e | 14 | //pc.printf("LPC1114 demo \r\n"); |
poushen | 0:48b5be00cf5e | 15 | |
poushen | 0:48b5be00cf5e | 16 | while(1) { |
poushen | 0:48b5be00cf5e | 17 | myled = 1; |
poushen | 0:48b5be00cf5e | 18 | printf("led on\n\r"); |
poushen | 0:48b5be00cf5e | 19 | for (int i=0; i<1000000; i++); |
poushen | 0:48b5be00cf5e | 20 | //wait(1); |
poushen | 0:48b5be00cf5e | 21 | myled = 0; |
poushen | 0:48b5be00cf5e | 22 | printf("led off\n\r"); |
poushen | 0:48b5be00cf5e | 23 | for (int i=0; i<1000000; i++); |
poushen | 0:48b5be00cf5e | 24 | //wait(1); |
poushen | 0:48b5be00cf5e | 25 | } |
poushen | 0:48b5be00cf5e | 26 | } |