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.

Dependencies:   mbed

Fork of lpc1114test by Saudin Dizdarevic

Files at this revision

API Documentation at this revision

Comitter:
psimik
Date:
Sat Nov 09 22:40:39 2013 +0000
Parent:
5:051be37cfef7
Commit message:
append comments

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat Nov 09 16:25:45 2013 +0000
+++ b/main.cpp	Sat Nov 09 22:40:39 2013 +0000
@@ -1,8 +1,8 @@
 #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)
-PwmOut pwm(dp1);         // PWM connect to P0_8: CT16B0_MAT0 (pin1); sorry, blocking SPI!  
+// naked LPC1114 on breadboard, install LED pin28, pasive piezo-buzzer pin1
+DigitalOut myled(dp28);  // LED ... P0_7 (pin 28)
+Serial uart(dp16, dp15); // UART .. P1_7: TX (pin 16), P1_6: RX (pin 15)
+PwmOut pwm(dp1);         // PWM ... P0_8: CT16B0_MAT0 (pin1); sorry, blocking SPI!  
 
 int main() {
 char c = '0';
@@ -11,11 +11,11 @@
   uart.puts("Start.\n\r");
   while(1) {    // repeat (period 1sec)
     myled = 0;  // LED on
-    pwm = 0.5;  // PWM duty cycle 50%
+    pwm = 0.5;  // PWM duty cycle 50%, tone 1kHz
     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
+    pwm = 0;    // PWM stop, silent
     wait(0.5);
     uart.puts(" Hello world.\n\r");  // Put String "Hello..."
     }