hi

Dependencies:   mbed Servo

WIFI.cpp

Committer:
injokim
Date:
2018-12-09
Revision:
0:b9dc28a0bfcc

File content as of revision 0:b9dc28a0bfcc:

#include "header.h"

Serial pc(SERIAL_TX, SERIAL_RX,115200);
Serial board(PA_11, PA_12,115200);
char in;
    
void wifi_init()
{
    pc.attach(&RX_interrupt1);
    board.attach(&RX_interrupt2);
    
    board.printf("+++");
    wait(0.5);
    
    board.printf("AT+E\r");
    wait(0.5);
    
    board.printf("AT+WMODE=STA\r");
    wait(0.5);
    
    board.printf("AT+TMODE=cmd\r");
    wait(0.5);
    
    board.printf("AT+WSSSID=iPhone\r"); //아까 세팅한 AP이름으로
    wait(0.5);
    
    board.printf("AT+WSKEY=WPA2PSK,AES,123456780\r");
    wait(0.5);
    
    board.printf("AT+NETP=TCP,CLIENT,8899,13.124.51.161\r");
    wait(0.5);
    
    board.printf("AT+TMODE=throughput\r");
    wait(0.5);
    
    board.printf("AT+ENTM\r");
    wait(0.5);
}

void RX_interrupt1(){
    in = pc.getc();
    board.putc(in);
}

void RX_interrupt2(){
    pc.putc(board.getc());
}

void wifi_print()
{
    board.printf("Obstacle!!");
}