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.
Dependencies: mbed
Diff: WROOM2.cpp
- Revision:
- 3:01b3fe95a585
- Parent:
- 2:eaf4e7fa577e
- Child:
- 4:6d3ca9d6109e
--- a/WROOM2.cpp Mon Mar 25 05:53:15 2019 +0000 +++ b/WROOM2.cpp Wed Apr 10 02:47:18 2019 +0000 @@ -44,16 +44,12 @@ term->attach(this, &KBline::serialirq); } char *getline() { while (receiving) wait(0.1); - return(line); } - } ; - + return(line); } } ; class Wroom //tried to extend Serial but failed ... - { - char sendbuf[256]; + { char sendbuf[256]; char recvbuf[MAXRECVBUF]; /* 1024 */ Serial *port, *pc; - /* Timer tm; */ Timeout tmout; int recvindex; @@ -65,21 +61,15 @@ tmout.detach(); recvbuf[recvindex++]=0; /*NULL at the end*/ receiving=0; } /* receiving finished*/ - void prerecvtimeout() { - } void recvirq() { while (port->readable()) { recvbuf[recvindex++]=port->getc(); if (recvindex>=MAXRECVBUF) recvindex=0; } receiving=2; tmout.detach(); - tmout.attach(this, &Wroom::recvtimeout, 1.0); - } - void sendirq() { - } + tmout.attach(this, &Wroom::recvtimeout, 1.0); } void start_receiving() { - recvindex=0; receiving=1; - } + recvindex=0; receiving=1; } char *getreply() { /* tmout.attach(this, &Wroom::recvtimeout, 7.0);*/ while (receiving) { wait(0.1); } @@ -114,9 +104,7 @@ this->atcom("AT+CWLAP"); //AP list pc->printf("CWLAP-->%s\n", this->getreply()); // connection to AP giving SSID and PASS is not programmed. - } - }; - + } }; DigitalOut myled(LED4), led1(LED1), led2(LED2), led3(LED3); AnalogIn adc(p20); @@ -183,8 +171,6 @@ if (strstr(request, "led2=0")) led2=0; } - - int main() { char *line, *page; pc.baud(9600);