Thank you for the code!
In a few days I'll get my own Arduino. Then I'll look for your code and test it.