Simple usage of wifi module ESP826601.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "ESP826601.h"
00003 
00004 Esp ESP;
00005 DigitalOut myled(LED1);
00006 Ticker tick;
00007 
00008 void readData(){
00009     myled = !myled;
00010 }
00011 
00012 int main() {
00013     tick.attach(&readData, 0.5);
00014     
00015     ESP.init();
00016     ESP.send("AT+CIFSR");
00017     ESP.waitResponse();
00018     ESP.send("AT+CIPMUX=1");
00019     ESP.waitResponse();
00020     ESP.send("AT+CIPSERVER=1,80");
00021     ESP.waitResponse();
00022     
00023     tick.detach();
00024     myled = 0;
00025     
00026     while(1){
00027         ESP.waitConnection();
00028         ESP.send("Pozdrav od Zvonimira");
00029         ESP.closeConnection();
00030     }
00031 }
00032 
00033