Package COBS

Dependencies:   mbed UsaPack

main.cpp

Committer:
cocorlow
Date:
2021-04-26
Revision:
1:562dd758a8e4
Parent:
0:6a74f8d2aab2

File content as of revision 1:562dd758a8e4:

#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;
    int d;
    slave.Subscribe(123, &p);
    slave.Subscribe(456, &d);
    while (1)
    {
        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]);
        }
        pc.printf("d:%d\r\n", d);
        wait(0.5);
    }
}