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 Serial_2 by
Revision 1:7b45959a62d9, committed 2016-09-04
- Comitter:
- liuminhaw
- Date:
- Sun Sep 04 03:41:20 2016 +0000
- Parent:
- 0:5d2615cbb0df
- Commit message:
- mbed with arduino
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Aug 27 11:22:23 2016 +0000 +++ b/main.cpp Sun Sep 04 03:41:20 2016 +0000 @@ -1,20 +1,27 @@ #include "mbed.h" -DigitalOut led(D2); -Serial pc(USBTX, USBRX); + +#define esp8266 pc +DigitalOut led_extern(PB_15); +DigitalOut led(LED1); +//Serial pc(USBTX, USBRX); +Serial esp8266(PB_6, PB_7); char val; int main() { - pc.baud(9600); + pc.baud(115200); + //esp8266(115200); while(1) { if(pc.readable()) { - pc.printf("Ready\n"); + //pc.printf("Ready\n"); val = pc.getc(); if(val=='a'){ led = 1 ; - pc.printf("LED ON\n"); + led_extern = 1; + //pc.printf("LED ON\n"); } else if (val == 'b') { led = 0; - pc.printf("LED OFF\n"); + led_extern = 0; + //pc.printf("LED OFF\n"); } } }