mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 20:04:58 +00:00
Merge branch 'main' of ssh://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79
This commit is contained in:
@@ -19,15 +19,15 @@ void setup(){
|
||||
robot.startCommunication("/dev/ttyUSB0", true, null_ptr);
|
||||
client.connect();
|
||||
client.subscribe("home/commands");
|
||||
parseMQTT(readMQTT());
|
||||
}
|
||||
|
||||
int main(){
|
||||
setup();
|
||||
client.run();
|
||||
while(true){
|
||||
readMQTT();
|
||||
parseMQTT(readMQTT());
|
||||
cout << readMQTT() << endl; //debugging
|
||||
}
|
||||
client.run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ std::string readMQTT()
|
||||
if (!message.empty()) {
|
||||
std::cout << "MQTT Message: " << message << std::endl;
|
||||
}
|
||||
|
||||
else {
|
||||
std::cout << "No message received" << std::endl;
|
||||
}
|
||||
// Add a small delay to avoid busy-waiting
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
return message;
|
||||
|
Reference in New Issue
Block a user