for testing
Dependencies: ESP8266Interface
Dependents: Nucleo_i2c_OLED_BME280_copy
Fork of ESP8266_Test by
setwifi.h
- Committer:
- hank51017
- Date:
- 2016-06-28
- Revision:
- 17:4c0f80896a21
- Parent:
- 16:acd6c6b72b27
File content as of revision 17:4c0f80896a21:
#include "mbed.h" #include "ESP8266Interface.h" #include "TCPSocketConnection.h" extern RawSerial pc; // For monitoring data from ESP8266 Timeout timer_buffer_debug; CircBuffer<char> buffer_ESP8266_recv(1024); void print_buffer_ESP8266() { char c=0; while ( buffer_ESP8266_recv.available() ) { buffer_ESP8266_recv.dequeue(&c); pc.putc(c); } timer_buffer_debug.attach(&print_buffer_ESP8266, 0.1); } int setwifi(ESP8266Interface *wifi) { timer_buffer_debug.attach(&print_buffer_ESP8266, 0.5); bool result; wifi->init(); result = wifi->connect(); if ( !result ) { printf("wifi.connect error\r\n"); return -1; } /* TCPSocketConnection socket; while (socket.connect(TEST_SERVER_ADDRESS, TEST_SERVER_PORT) < 0) { pc.printf("Unable to connect to (%s) on port (%d)\n", TEST_SERVER_ADDRESS, TEST_SERVER_PORT); wait(1); } char rev[1024] = {0}; char hello[] = "Hello Man\r\n"; socket.send_all(hello, sizeof(hello)-1); socket.receive(rev, 1024); pc.printf("%s\r\n", rev); socket.close();*/ return 0; }