Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 /*
00003 DigitalOut myled(LED1);
00004 
00005 int main() {
00006     while(1) {
00007         myled = 1;
00008         wait(0.2);
00009         myled = 0;
00010         wait(0.2);
00011     }
00012 }
00013 */
00014 
00015 #include <LPC17xx.h>
00016 #include <stdlib.h>
00017 #include "typedefs.h"
00018 #include "UARTs.h"
00019 
00020 PwmOut led1(LED1);
00021 
00022 int
00023 main()
00024 {
00025     UI_32 x, n;
00026     LPC_SC_TypeDef *sc;
00027 
00028     sc=(LPC_SC_TypeDef *) LPC_SC;
00029     n=sc->PCLKSEL0;
00030 
00031     init_UARTs(UART0,DATABITS5,STOPBITS1,PARITYFORCED1,BREAKDISABLE);
00032     init_UARTs(UART1,DATABITS6,STOPBITS2,PARITYFORCED0,BREAKDISABLE);
00033     init_UARTs(UART2,DATABITS7,STOPBITS1,PARITYODD,BREAKDISABLE);
00034     init_UARTs(UART3,DATABITS8,STOPBITS2,PARITYEVEN,BREAKDISABLE);
00035 
00036     for(x=0;x<n;x++)
00037     {
00038         led1 = (sinf(x)+1)/4;
00039         wait(0.01);
00040     }
00041 
00042     led1 = 0.5;
00043     return 0;
00044 }