So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By M3-L7
#74695 Hello again I found out that is better to use this code:
#define UART_BAUD 9600
const char *ssid = "M3-L7";
const char *pw = "123456";
const int port = 8899;

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <Servo.h>

WiFiServer server(port);
WiFiClient client;

byte buf1[256];
byte i1=0;

byte buf2[1024];
byte i2=0;

void setup() {

delay(500);

Serial.begin(UART_BAUD);

WiFi.mode(WIFI_AP);
IPAddress ip(10, 10, 100, 254);
IPAddress netmask(255, 255, 255, 0);
WiFi.softAPConfig(ip, ip, netmask);
WiFi.softAP(ssid, pw);

server.begin();
}
void loop() {

if(!client.connected()) {
client = server.available();
return;
}

if(client.available()) {
while(client.available()) {
buf1[i1] = (byte)client.read();
if(i1<1023) i1++;
}
Serial.write(buf1, i1);
i1 = 0;

}
if(Serial.available()) {
while(Serial.available()) {
buf2[i2] = (char)Serial.read();
if(i2<1023) i2++;
}
client.write((char*)buf2, i2);
i2 = 0;
}
}

but ive got an app in which sends data every 10 ms, If I understood it correctly
header (4bytes): 85 0 11 0
channels (4bytes): X X X X
end (2bytes): 0 0
checksum (1bytes): Y
but what im receving is something like this "?U 22?U 22?U 22?U 22?U 22...." also when I connect for example to roboremo it has no problem with receiving something like "ch1 1354"