![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First test on using mbed library with naked LPC1114 chip on breadboard. Blink LED pin 28, append UART test, procedure putc(), puts(), PWM beep 1kHz on pin 1.
Fork of lpc1114test by
Diff: main.cpp
- Revision:
- 1:8aecb799ae5e
- Parent:
- 0:15ea674d67d9
- Child:
- 2:6b5d2029ec07
diff -r 15ea674d67d9 -r 8aecb799ae5e main.cpp --- a/main.cpp Thu Oct 31 18:48:11 2013 +0000 +++ b/main.cpp Sat Nov 09 13:16:32 2013 +0000 @@ -1,12 +1,18 @@ #include "mbed.h" - -DigitalOut myled(dp28); +// naked LPC1114 on breadboard +DigitalOut myled(dp28); // LED connect to P0_7 (pin 28) +Serial uart(dp16, dp15); // UART connect to P1_7: TX (pin 16), P1_6: RX (pin 15) int main() { - while(1) { - myled = 1; - wait(1); - myled = 0; - wait(1); +char c = '0'; + uart.baud(115200); // Baud rate + uart.puts("Start.\n\r"); + while(1) { // repeat (period 1sec) + myled = 0; // LED on + wait(0.5); + uart.putc(c++); if (c > '9') c = '0'; // put character & rotate 0,1,2,... 9 + myled = 1; // LED off + wait(0.5); + uart.puts(" Hello world.\n\r"); // Put String "Hello..." } }