Seri port okuma(Discovery) ve hc05
Dependencies: mbed-src MODSERIAL
Diff: main.cpp
- Revision:
- 5:73ac83c240ec
- Parent:
- 3:2f5485de3328
- Child:
- 7:804c6a1f49ce
--- a/main.cpp Tue Aug 12 16:11:43 2014 +0000 +++ b/main.cpp Tue Aug 12 16:16:02 2014 +0000 @@ -1,6 +1,6 @@ /* * Author: Edoardo De Marchi - * Date: 02-07-13 + * Date: 12-08-14 * Notes: HC05 AT command */ @@ -8,17 +8,19 @@ #include "MODSERIAL.h" -#define SERIAL_1 - -#ifdef SERIAL_1 -MODSERIAL blue(p9,p10); // HC05 -#endif -#ifdef SERIAL_2 -MODSERIAL blue(p13,p14); // HC05 -#endif MODSERIAL pc(USBTX, USBRX); DigitalOut led1(LED1); -DigitalOut led4(LED4); + + +#if defined(TARGET_LPC1768) +MODSERIAL blue(p9, p10); // TX = P9 RX = P10 +//MODSERIAL blue(p13, p14); // TX = P13 RX = P14 +#elif defined(TARGET_LPC4330_M4) +MODSERIAL blue(UART0_TX, UART0_RX); // P6_4, P6_5 +//MODSERIAL blue(UART3_TX, UART3_RX); // P2_3, P2_4 +#endif + + bool new_send = false; @@ -63,6 +65,7 @@ pc.attach(&rxPcCallback, MODSERIAL::RxIrq); pc.printf("AT Mode Start\r\n"); + int i = 0; while(1) { @@ -92,5 +95,11 @@ new_response = false; } wait_ms(100); + i++; + if(i == 5) + { + led1 = !led1; + i=0; + } } } \ No newline at end of file