Thanks for your reply and apologies for posting just the snippet.
Here is my full code:
#include <WiFi.h>
/* WiFi network name and password */
const char * ssid = "WiFi Guest_";
const char * pwd = "";
/* Ip address of server (PC) and udp port - same as python script */
const char * hostIP = "192.168.10.36";
const int port = 1234;
// number of active channels and number of timesteps sent with one packet
#define numOfCh 8
#define numOfTs 64
int adcSample1 = 0b1111111111111110;
int adcSample2 = 0b1111111111111110;
WiFiClient client;
void sendTCP(long packet[numOfCh + 2][numOfTs / 2]);
void setup()
{
Serial.begin(115200);
Serial.print("Connecting to ");
Serial.println(ssid);
/* connect to your WiFi */
WiFi.begin(ssid, pwd);
/* wait until ESP32 connect to WiFi*/
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected with IP address: ");
Serial.println(WiFi.localIP());
}
void loop()
{
long buff[numOfCh + 2][numOfTs / 2];
for (int ts = 0; ts < numOfTs; ts++) {
for (int ch = 0; ch < numOfCh; ch++) {
if (ts % 2 == 0) {
buff[ch][ts / 2] = adcSample1 << 16;
if (ch == 0) {
buff[8][ts / 2] = micros();
}
}
else {
buff[ch][ts / 2] += adcSample2;
if (ch == 0) {
buff[9][ts / 2] = micros();
}
}
}
}
client.connect(hostIP, port);
while (!client.connected()) {
client.connect(hostIP, port);
Serial.println("Not connected");
}
client.write((uint8_t*)buff, sizeof(buff));
Serial.println("Connected");
}
Is this what you mean? I am no longer receiving "Not connected"), however on the receiving end the packets are coming in at inconsistent speeds (even when I comment out serial.print())
(You can ignore the filling of the packet with a 2d array.)