I want to add a switch case statement when wifi is connected, but i dont know how to to add can someone please help me. I am a newbie.
void loop() {
if (WiFi.status() == WL_CONNECTED) {
WiFiClient client;
HTTPClient http;
}
else
{
Serial.println("WiFi Disconnected");
}
}
What's the purpose of the switch case when WiFi is connected?
Actually what are you trying to do?
my purpose is when wifi is connected go to switch statement and perform these tasks. read rfid tag => go to check user => display user id => request temperature => post temperature.
void readCard() {}
void getUser() {}
void checkUserStatus() {}
void displayUserId() {}
void tempRequest() {}
void posttemp() {}
int TheCaseCounter= 0;
void loop() {
if (WiFi.status() == WL_CONNECTED) {
WiFiClient client;
HTTPClient http;
switch( TheCaseCounter )
{
case readcard:
doTheReadCardThing();
break;
case getuser:
dothegetuserthing();
break;
defalut:
break;
}
TheCaseCounter++;
}
else
{
Serial.println("WiFi Disconnected");
}
}
I'm sure you did a search on the internet and you did not find any tips on using switch case. In that case I gave you, above, a few clues.
And, perhaps, this link may help: C++ switch...case Statement (With Examples) (programiz.com)
Thank you.. i will try it
Is this something like what you mean ?
Yes what?
Communications will help as your skills improve.
Sorry i meant yes this is what i wanted
system
Closed
May 1, 2022, 9:41pm
10
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.