mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 20:04:58 +00:00
testing cpp
This commit is contained in:
@@ -23,14 +23,15 @@ void setup(){
|
|||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
setup();
|
setup();
|
||||||
|
while(true){
|
||||||
readMQTT();
|
readMQTT();
|
||||||
|
}
|
||||||
client.run();
|
client.run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string readMQTT()
|
std::string readMQTT()
|
||||||
{
|
{
|
||||||
while (true) {
|
|
||||||
std::string message = client.getLastMessage();
|
std::string message = client.getLastMessage();
|
||||||
if (!message.empty()) {
|
if (!message.empty()) {
|
||||||
std::cout << "MQTT Message: " << message << std::endl;
|
std::cout << "MQTT Message: " << message << std::endl;
|
||||||
@@ -39,7 +40,6 @@ std::string readMQTT()
|
|||||||
// Add a small delay to avoid busy-waiting
|
// Add a small delay to avoid busy-waiting
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
return message;
|
return message;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user