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:
- 3:23f3f69678be
- Parent:
- 2:6b5d2029ec07
- Child:
- 4:0ae9bda1e421
--- a/main.cpp Sat Nov 09 13:30:11 2013 +0000 +++ b/main.cpp Sat Nov 09 15:53:14 2013 +0000 @@ -1,17 +1,21 @@ #include "mbed.h" // 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) +Serial uart(dp16, dp15); // UART connect to P1_7: TX (pin 16), P1_6: RX (pin 15) +PwmOut pwm(dp1); // PWM connect to P0_8: CT16B0_MAT0 (pin1) provisional, blocking SPI! (MISO) int main() { -char c = '0'; +char c = '0'; + pwm.period(0.001); // PWM period 1ms (1kHz) uart.baud(115200); // Baud rate uart.puts("Start.\n\r"); while(1) { // repeat (period 1sec) myled = 0; // LED on + pwm = 0.5; // PWM duty cycle 50% wait(0.5); uart.putc(c++); if (c > '9') c = '0'; // Put Character & rotate 0,1,2,... 9 myled = 1; // LED off + pwm = 0; // PWM stop wait(0.5); uart.puts(" Hello world.\n\r"); // Put String "Hello..." }