Skip to content

Instantly share code, notes, and snippets.

View celikhakan's full-sized avatar
👁️
I may be slow to respond.

Hakan ÇELİK celikhakan

👁️
I may be slow to respond.
View GitHub Profile
@nonsintetic
nonsintetic / struct_union.ino
Last active August 11, 2023 00:23
Arduino structures and unions
/* Arduino data manipulation and concatenation with structures and unions
*
* This simple (ish) sketch shows you how to organize your data into a struct
* and then access the whole thing as a byte array.
*
* Useful if you want to concatenate several variables into a single byte array
* to send over bluetooth, i2c, lora or any other protocol that works with arrays.
* In other words you have a fixed byte array, and we squeeze in variables of different
* data types and lengths into it, while still using it as a byte array afterwards.
*