I have problems trying to do the opposite now: I want the LinkIt to be a TCP server and receive commands from clients.
This is my code, based on the mediatek documentation (sadly there are no working examples), but I can’t understand why it doesn’t work.
It connects to the Wi-Fi just fine, yet it refuses all the connections by the clients.
[code]#include <LWiFi.h>
#include <LWiFiClient.h>
#include <LWiFiServer.h>
#define AP_NAME “TP-LINK”
#define PASSWORD “mypassword”
#define PORT 8080
boolean first = true;
LWiFiClient c;
LWiFiServer server(8080);
void setup() {
Serial.begin(9600);
LWiFi.begin();
LWiFi.connectWPA(AP_NAME, PASSWORD);
Serial.println(“Connected to Wi-Fi!”);
server.begin();
}
void loop() {
if(first){
c = server.available();
first = false;
}
if(c.available()){
char ch = c.read();
Serial.print(ch);
}
delay(1000);
}[/code]
Any ideas on how to make this work? Thank you