added logic for direction detection
Merge branch 'master' of https://github.com/postfalk/Arduino