testing cpp

This commit is contained in:
2024-10-24 13:33:28 +02:00
parent dfb1415940
commit edf1cabdf3

View File

@@ -23,14 +23,15 @@ void setup(){
int main(){
setup();
while(true){
readMQTT();
}
client.run();
return 0;
}
std::string readMQTT()
{
while (true) {
std::string message = client.getLastMessage();
if (!message.empty()) {
std::cout << "MQTT Message: " << message << std::endl;
@@ -39,7 +40,6 @@ std::string readMQTT()
// Add a small delay to avoid busy-waiting
std::this_thread::sleep_for(std::chrono::milliseconds(100));
return message;
}
}