Thanks for your code example. It would be great if you could include a schematic. Because there is no shematic i cant put this in the User Projects section, but i have put the code example in the wiki here

Thank you for your contribution