# \[ANN\] Consistent Overhead Byte Stuffing: COBS.jl

**URL:** <https://discourse.julialang.org/t/ann-consistent-overhead-byte-stuffing-cobs-jl/30130>\
**Category:** Package Announcements\
**Created:** [October 21, 2019, 11:30am UTC](https://discourse.julialang.org/t/ann-consistent-overhead-byte-stuffing-cobs-jl/30130 "2019-10-21T11:30:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [October 21, 2019, 11:30am UTC](https://discourse.julialang.org/t/ann-consistent-overhead-byte-stuffing-cobs-jl/30130/1 "2019-10-21T11:30:21Z")

</div>

[COBS.jl](https://github.com/yakir12/COBS.jl) is a tiny tiny package I just wrote for encoding bytes according to the [COBS](https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing) algorithm. This will be mostly useful for people communicating with an Arduino via a serial port.

My main goal was to write something I need. I needed to encode, not decode, so there’s only an `encode` function… But my hopes are that others that might need this will contribute in the future. Any comment is welcomed!

It’s not registered yet.

This spurred from the fruitful conversation and helpful input from all the wonderful people in this topic:

> [@Control Arduino](https://discourse.julialang.org/t/control-arduino/29982):
>
> Hi! I want to control an LED strip (DotStar) from an Arduino UNO. Is there anything new in this domain? I managed to find these 3 resources: [https://gitlab.control.lth.se/labdev/LabConnections.jl](https://gitlab.control.lth.se/labdev/LabConnections.jl) but maybe I missed something, perhaps this has some implications on that?

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [October 24, 2019, 12:49pm UTC](https://discourse.julialang.org/t/ann-consistent-overhead-byte-stuffing-cobs-jl/30130/2 "2019-10-24T12:49:42Z")

</div>

And now with decoding as well (albeit not directly from a port).

---

<div class="post-metadata">

**Author:** ![KajWiik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kajwiik/32/199_2.png) [@KajWiik](https://discourse.julialang.org/u/KajWiik)\
**Post date:** [October 24, 2019, 2:09pm UTC](https://discourse.julialang.org/t/ann-consistent-overhead-byte-stuffing-cobs-jl/30130/3 "2019-10-24T14:09:52Z")

</div>

How I can mark more than one heart :-)? This has been a long time TODO for me but been too busy. Many thanks!

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [October 24, 2019, 2:11pm UTC](https://discourse.julialang.org/t/ann-consistent-overhead-byte-stuffing-cobs-jl/30130/4 "2019-10-24T14:11:26Z")

</div>

he he… you’re welcome!

But please check and see if it works as expected, in terms of correctness of course, but also if it’s fast enough. Feel free to PR etc…

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [November 8, 2019, 7:50am UTC](https://discourse.julialang.org/t/ann-consistent-overhead-byte-stuffing-cobs-jl/30130/5 "2019-11-08T07:50:01Z")

</div>

and now it’s registered, so all you need to do is

```julia
] add COBS

```

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [December 5, 2023, 8:23pm UTC](https://discourse.julialang.org/t/ann-consistent-overhead-byte-stuffing-cobs-jl/30130/6 "2023-12-05T20:23:14Z")

</div>

I feel it’s worth mentioning that there is a new COBS package and I _think_ it’s better:

> **[GitHub - wherrera10/COBSReduced.jl: COBS packet encoding](https://github.com/wherrera10/COBSReduced.jl)**
>
> COBS packet encoding. Contribute to wherrera10/COBSReduced.jl development by creating an account on GitHub.
