HAPSRG
/
TWELITE_Slave_0001
Package COBS
Diff: main.cpp
- Revision:
- 0:6a74f8d2aab2
- Child:
- 1:562dd758a8e4
diff -r 000000000000 -r 6a74f8d2aab2 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Apr 24 04:31:18 2021 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +#include "UsaPack.hpp" + +UsaPack slave(PC_12, PD_2, 9600); +Serial pc(USBTX, USBRX, 115200); + +struct pack +{ + float a[10]; + int b[10]; +}; + +int main() +{ + pack p; + slave.Subscribe(123, &p); + while (1) + { + for (int i = 0; i < 10; i++) + { + for (int j = 0; j < 10; j++) + { + pc.printf("a:%f\r\n", p.a[j]); + } + for (int j = 0; j < 10; j++) + { + pc.printf("b:%d\r\n", p.b[j]); + } + } + wait(1.0); + } +} \ No newline at end of file