sagos
October 27, 2015, 9:28am
1
I would like to send a various data. But when i try to send "val" it skip loop.
"http://"+ipAddress+":"+portNumber+"/?"+parameterName+"="+parameterValue);
When i click one button
parameterName = "pin"
when i click another button
parameterName = "val"
int connectionId = esp8266.read() - 48;
if(esp8266.find("pin=")==true){ // advance cursor to "pin="
int pinNumber = (esp8266.read() - 48);
int secondNumber = (esp8266.read() - 48);
if (secondNumber >= 0 && secondNumber <= 9)
{
pinNumber *= 10;
pinNumber += secondNumber;
}
digitalWrite(pinNumber, !digitalRead(pinNumber)); // toggle pin
}
/////////////////////////////////////////////////
if(esp8266.find("val=")==true){
int pinNumber2 = (esp8266.read() - 48);
int secondNumber2 = (esp8266.read() - 48);
if (secondNumber2 >= 0 && secondNumber2 <= 9)
{
pinNumber2 = 10;
pinNumber2 += secondNumber2;
}
Setpoint = pinNumber2 2.5;
}
The problem is that when i click button with val it skip loop. I dont know how to send two various data. When i click button with pin it's working.
system
October 27, 2015, 10:07am
2
int connectionId = esp8266.read() - 48;
Even if there is nothing to read, or the character read was a 'D'. Hmmm...
int pinNumber = (esp8266.read() - 48);
int secondNumber = (esp8266.read() - 48);
Even if there is nothing to read, or the character read was a 'D'. Hmmm...
The problem is that when i click button with val it skip loop.
We have no idea what you are talking about. There is NO button in the snippet of crappy code you posted.
Every { belongs on a line BY ITSELF. Every } belongs on a line BY ITSELF. The code in between needs to be properly indented. Use Tools + Auto Format.
Some Serial.print() statements would be in order.
Robin2
October 27, 2015, 10:45am
3
sagos:
I would like to send a various data.
As far as I can see the code in the snippet you posted is trying to receive data. And it is not doing that in a reliable way. Have a look at Serial Input Basics
Post your complete program.
And please use the code button </>
so your code looks like this
and is easy to copy to a text editor
...R