-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
43 lines (31 loc) · 871 Bytes
/
Copy pathmain.cpp
File metadata and controls
43 lines (31 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Este archivo es temporal, no está planeado dejarlo en el repositorio.
#include "serial_cpp/serial.h"
#include "EasyLoRa.hpp"
#include "ModuleConfig.hpp"
#include <thread>
#include <iostream>
#include <chrono>
#include <thread>
using namespace std;
void sendAlive() {
EasyLoRa lora{ "/dev/ttyACM0" };
for (size_t i = 0; ; ++i) {
lora.sendData("Alive");
std::this_thread::sleep_for(std::chrono::milliseconds{40});
}
}
[[noreturn]]
void getAlive() {
EasyLoRa lora{ "/dev/ttyACM1" };
while (true) {
const auto message{ lora.receiveData() };
cout << message.size() << message << '\n';
}
}
int main() {
EasyLoRa lora{ "/dev/ttyACM0" };
std::this_thread::sleep_for(std::chrono::milliseconds{1000});
ModuleConfig conf;
conf.setAddressHighByte(0x19);
lora.setConfiguration(conf, true);
}