Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of lpc1114test by
main.cpp@6:01a61ae34a8a, 2013-11-09 (annotated)
- Committer:
- psimik
- Date:
- Sat Nov 09 22:40:39 2013 +0000
- Revision:
- 6:01a61ae34a8a
- Parent:
- 5:051be37cfef7
append comments
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| sdizdarevic | 0:15ea674d67d9 | 1 | #include "mbed.h" |
| psimik | 6:01a61ae34a8a | 2 | // naked LPC1114 on breadboard, install LED pin28, pasive piezo-buzzer pin1 |
| psimik | 6:01a61ae34a8a | 3 | DigitalOut myled(dp28); // LED ... P0_7 (pin 28) |
| psimik | 6:01a61ae34a8a | 4 | Serial uart(dp16, dp15); // UART .. P1_7: TX (pin 16), P1_6: RX (pin 15) |
| psimik | 6:01a61ae34a8a | 5 | PwmOut pwm(dp1); // PWM ... P0_8: CT16B0_MAT0 (pin1); sorry, blocking SPI! |
| sdizdarevic | 0:15ea674d67d9 | 6 | |
| sdizdarevic | 0:15ea674d67d9 | 7 | int main() { |
| psimik | 3:23f3f69678be | 8 | char c = '0'; |
| psimik | 3:23f3f69678be | 9 | pwm.period(0.001); // PWM period 1ms (1kHz) |
| psimik | 1:8aecb799ae5e | 10 | uart.baud(115200); // Baud rate |
| psimik | 1:8aecb799ae5e | 11 | uart.puts("Start.\n\r"); |
| psimik | 1:8aecb799ae5e | 12 | while(1) { // repeat (period 1sec) |
| psimik | 1:8aecb799ae5e | 13 | myled = 0; // LED on |
| psimik | 6:01a61ae34a8a | 14 | pwm = 0.5; // PWM duty cycle 50%, tone 1kHz |
| psimik | 1:8aecb799ae5e | 15 | wait(0.5); |
| psimik | 2:6b5d2029ec07 | 16 | uart.putc(c++); if (c > '9') c = '0'; // Put Character & rotate 0,1,2,... 9 |
| psimik | 1:8aecb799ae5e | 17 | myled = 1; // LED off |
| psimik | 6:01a61ae34a8a | 18 | pwm = 0; // PWM stop, silent |
| psimik | 1:8aecb799ae5e | 19 | wait(0.5); |
| psimik | 1:8aecb799ae5e | 20 | uart.puts(" Hello world.\n\r"); // Put String "Hello..." |
| sdizdarevic | 0:15ea674d67d9 | 21 | } |
| sdizdarevic | 0:15ea674d67d9 | 22 | } |
