final sensor code
the software works