0

How do I make values be recognized?

I've been trying to make my Arduino read string to int and it keeps skipping the value, could someone please help

18th May 2022, 11:22 AM
Derrick Presley
5 Respuestas
0
else if (lastnewClientmsg == "|STX|STATUS|1|ETX|") { newClient.println("Choose type to dispense: 1. Milk 2. Yoghurt"); newClientMsg.replace("\n",""); newClientMsg.replace("| ","|"); Serial.println("PART 6 REPLACEMENT :" + newClientMsg + " and length is : " + newClientMsg.length()); Serial.println("we get" +newClientMsg+" and length is : " + newClientMsg.length()); if (newClientMsg == "DIESEL"){ newClientMsg.remove(0, 700); newClient.println("Enter Amount to dispense Milk:"); int y = newClientMsg.toInt (); digitalWrite(13, HIGH); // sets the digital pin 13 on Serial.println("typehere value is:" + type_here); delay(y); // waits for a second digitalWrite(13, LOW); // sets the digital pin 12 Serial.println("we are the champions"); Serial.println("QQQQQQQQQQQQQQQQQQQQQQQQQQQ :" + lastnewClientmsg + " and length is : " + lastnewClientmsg.length()); newClientMsg.remove(0, 700); Serial.println("DDDDDDDDDDDDDDDDDD :" + lastnewClientmsg + "and length is : " + lastnewClientmsg.length()); }
19th May 2022, 12:19 PM
Derrick Presley
0
The delay y gets skipped
19th May 2022, 12:21 PM
Derrick Presley
0
It's Arduino so I assumed it is c++ which according to thenet it is
19th May 2022, 6:06 PM
Derrick Presley