Package COBS

Dependencies:   mbed UsaPack

main.cpp

Committer:
cocorlow
Date:
2021-04-24
Revision:
0:6a74f8d2aab2
Child:
1:562dd758a8e4

File content as of revision 0:6a74f8d2aab2:

#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);
    }
}