Fixed Y and Z reads, ported to work on Due.

Previous version did not return correct values for Y or Z, and did not work on Due. 

New version corrects these; Due cannot use direct port writes as provided in this code.