11

esp8266.cpp

Committer:
yezhong
Date:
2022-06-24
Revision:
1:e8b9ee1156c8
Parent:
0:a94222cedd2e

File content as of revision 1:e8b9ee1156c8:

#include "esp8266.h"
#include <algorithm>
#include <cctype>
#include "wifi_example.h"
#include "data_pc.h"


void moshi(void)
{
   wifi.printf("AT+CWMODE=3\r\n");
}

void mima(void)
{
   wifi.printf("AT+CWJAP=\"%s\",\"%s\"\r\n","prc1","Prc123456");
}
  
void getMyIP(void)
    {
    wifi.printf("AT+CIFSR\r\n");
    wait(2);
    char buf[2000];
    int counter = 0;
    while(1){
     if(wifi.readable()){
        buf[counter] = wifi.getc();
        counter = counter + 1;
     }else{
        wait(2);
        if(!wifi.readable()){
          break;   
        }   
     }   
    }
    
   return ;
}

/*
void getMyIP(void)
{
    wifi.printf("AT+CIFSR\r\n");
}
*/



void lianjie(void)
{
   wifi.printf("AT+CIPMUX=0\r\n");
    }
    
void UDP(void)
{
   wifi.printf("AT+CIPSTART=\"%s\",\"%s\",%d,%d,%d\r\n","UDP","127.0.0.1",8585,8585,0);
    }