# Interface Skywriter HAT to main C++ on RPi2

**URL:** <https://forums.pimoroni.com/t/interface-skywriter-hat-to-main-c-on-rpi2/1821>\
**Category:** Support\
**Created:** [February 15, 2016, 12:41am UTC](https://forums.pimoroni.com/t/interface-skywriter-hat-to-main-c-on-rpi2/1821 "2016-02-15T00:41:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raspinewb](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@raspinewb](https://forums.pimoroni.com/u/raspinewb)\
**Post date:** [February 15, 2016, 12:41am UTC](https://forums.pimoroni.com/t/interface-skywriter-hat-to-main-c-on-rpi2/1821/1 "2016-02-15T00:41:08Z")

</div>

Hello! I have a new Raspberry Pi 2, and would like to make an application that uses the Skywriter HAT gesture sensing. I’d like to write the application in C++, but not sure how best to interface with Skywriter HAT. For Raspberry Pi 2, the Python library is readily available, so would you recommend I use Boost Python to poll the Skywriter HAT functions? I’m not very familiar with Boost, and not even sure threading would work with Boost. Your input would be much appreciated, thanks!

---

<div class="post-metadata">

**Author:** ![lunar](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/lunar/32/816_2.png) [@lunar](https://forums.pimoroni.com/u/lunar)\
**Post date:** [February 15, 2016, 12:14pm UTC](https://forums.pimoroni.com/t/interface-skywriter-hat-to-main-c-on-rpi2/1821/2 "2016-02-15T12:14:02Z")

</div>

The Python library is only 400 lines, so reimplementing it in C++ shouldn’t be too hard. Look at the source:  
[https://github.com/pimoroni/skywriter-hat/blob/master/python/library/skywriter.py](https://github.com/pimoroni/skywriter-hat/blob/master/python/library/skywriter.py)

You can controll the GPIO through _sysfs_ and do I2C communication via Linux `i2c_*` calls. You might get inspiration for the later by looking at the [source for backlight.c](http://forums.pimoroni.com/t/display-o-tron-display-ip-while-waiting-for-passphrase/1792).

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [February 15, 2016, 12:38pm UTC](https://forums.pimoroni.com/t/interface-skywriter-hat-to-main-c-on-rpi2/1821/3 "2016-02-15T12:38:53Z")

</div>

Possibly helpful, this is the library in Arduino C, which is a closer approximation of how it might work in C++.

> <https://github.com/pimoroni/skywriter-hat/blob/master/arduino/Skywriter/skywriter.cpp>
