Hi, I have seen some other people have a similar question but not have it adequately answered.
I am using a TCP client to send a string to my arduino. I can get it to be stored in a variable but I only want a specific part .
13:14:17.355 -> .
13:14:19.008 -> Msg Received = 0,CONNECT
13:14:19.008 ->
13:14:19.008 -> +IPD,0,10:MyPassword
13:14:21.202 -> .
As in I want the "MyPassword" portion to be stored so I use
void loop() {
Serial.println(".");
if(portOne.available()>0 && i==1){ //PassWord
PW = readfromWifi();
delay(200);
if(Serial.find("+IPD,0,10:")){
Serial.println("gottem");/// to confirm it found it
Serial.readBytesUntil('\r', MYData, 17); ///MYData is a char
}
}
it just doesn't work. its not printing "gottem" no matter what I put in the parenthesis except if I leave it as just "".
here is the "readfromWifi" function that I found to use
String readfromWifi(){
char arrayInMsg[100];
String tempStr;
int count =0;
while( portOne.available() > 0 ){
arrayInMsg[count]= portOne.read();
delay(50);
// getout if you see CR or LF
if (arrayInMsg[count] == "\n" or arrayInMsg[count] == "\r") break;
count++;
}
arrayInMsg[count] = '\0'; // Null terminate finally
tempStr = String (arrayInMsg); // cast it to string
tempStr.trim(); // precaution
Serial.print("Msg Received = ");
Serial.println(tempStr);
return tempStr;
}
any help would be appreciated. I am using Arduino uno, esp8266 01, mac os