Converting struct to byte and back to struct

前端 未结 4 1520
刺人心
刺人心 2021-01-31 04:21

I\'m currently working with Arduino Unos, 9DOFs, and XBees, and I was trying to create a struct that could be sent over serial, byte by byte, and then re-constructed into a stru

4条回答
  •  天涯浪人
    2021-01-31 04:52

    Always utilize data structures to its fullest..

    union AMG_ANGLES {
      struct {
        float yaw;
        float pitch;
        float roll;
      }data;
      char  size8[3*8];
      int   size32[3*4];
      float size64[3*1];
    };
    

提交回复
热议问题