Wifi module configuration for GR_Peach
Dependencies: mbed
Wifi.cpp
- Committer:
- akverma
- Date:
- 2017-01-04
- Revision:
- 2:19bd6403dc75
- Parent:
- 1:e5ef21ebff5f
File content as of revision 2:19bd6403dc75:
#include "mbed.h" #include <string> DigitalOut led1(LED1); DigitalOut led2(LED2); string data; uint8_t wifi_ack; Serial pc(USBTX, USBRX); //Serial Wifi(P2_14,P2_15); Serial Wifi(P5_0, P5_1); bool i = true; bool j = false; char MSB; char LSB; /* void call() { // Note: you need to actually read from the serial to clear the RX interrupt data = Wifi.getc(); pc.printf("%c\n", data); // Wifi.printf("%c",data); }*/ int main() { char c,d; //pc.attach(&call); pc.baud(9600); Wifi.baud(115200); //Wifi.attach(&call); /*while(1){ //Wifi.printf("AT\n"); //pc.printf("done!\n"); if(pc.readable()) { pc.putc(pc.getc()); led1 = ~led1; } if(Wifi.readable()) { pc.putc(Wifi.getc()); led2 = ~led2; } //wifi_ack = Wifi.getc(); //pc.printf("%c\n", wifi_ack); //wait(5); }*/ while (1) { if(Wifi.readable()) // check if the esp is sending a message { while(Wifi.readable()) { // The esp has data so display its output to the serial window c = Wifi.getc(); // read the next character. pc.putc(c); //pc.printf("%c", c); //i=~i; } } if(pc.readable()) // check if the esp is sending a message { while(pc.readable()) { // The esp has data so display its output to the serial window d = pc.getc(); // read the next character. Wifi.putc(d); //pc.printf("%c", c); //j=~j; } } // led1=i; // led2=j; } }