2
0
Files
lpsarii/main.cpp

42 lines
701 B
C++
Raw Normal View History

2026-01-09 07:46:52 +01:00
#include "main.hpp"
2026-01-09 09:25:37 +01:00
#include "AutomForArduino.cpp"
#undef timeout
#include "mqtt/async_client.h"
2026-01-09 07:46:52 +01:00
int main()
{
2026-01-09 09:25:37 +01:00
callback cb;
client.set_callback(cb);
mqtt::connect_options connOpts;
connOpts.set_clean_session(true);
connOpts.set_user_name("admin");
connOpts.set_password("geii2025");
try {
client.connect(connOpts)->wait();
client.start_consuming();
client.subscribe(TOPIC, QOS)->wait();
} catch (const mqtt::exception &exc) {
std::cerr << "Erreur MQTT: " << exc.what() << "\n";
}
2026-01-09 07:46:52 +01:00
while (1)
{
2026-01-09 09:52:51 +01:00
s0 = b0;
s1 = b1;
s2 = b2;
s3 = b3;
s4 = b4;
s5 = b5;
s6 = b6;
s7 = b7;
2026-01-09 10:10:14 +01:00
mqtt_process(&client);
2026-01-09 09:25:37 +01:00
}
2026-01-09 10:10:14 +01:00
mqtt_close();
2026-01-09 07:46:52 +01:00
return 0;
}