It seems if I skip the voltage calculation and go straight to the g calculation, then convert to angle, I get quite a bit of difference in the angle of x, y, z.
With the voltage step and offsets, I get the following on angles:
X: 0.041974933800873783 Y: -0.41450604992784712 Z: 65.376588015735521 X: -0.59290646870709129 Y: 0.50895272001477965 Z: 62.864042500339835 X: -1.7474773687631002 Y: -1.107157680696504 Z: 63.763641727439321 X: -0.30431967368129509 Y: 0.39351806301346776 Z: 63.503725175255653 X: 0.44598813546831534 Y: -0.29907273468431761 Z: 63.763641727439321 X: -0.65062539850273071 Y: -0.010493732570229987 Z: 63.763641727439321 X: -0.015740598965353455 Y: 0.22036892606078706 Z: 62.864042500339835 X: 0.15740618567488954 Y: 0.047221801648020693 Z: 62.990856852350745
Without the voltage step and offsets and using 6.0g instead of 3, I get the following:
X: -2.8975050412313226 Y: 7.9588318815438672 Z: 90 X: -2.8975050412313226 Y: 9.6579297791642684 Z: 74.444248900961227 X: -2.8134508092914667 Y: 9.0623482723407758 Z: 90 X: -3.4019678954538319 Y: 10.254566768819068 Z: 82.397076755629371 X: -3.1497059167086494 Y: 10.169265624836738 Z: 85.612598169987365 X: -2.8975050412313226 Y: 10.083987254504757 Z: 80.684933454463348 X: -3.4019678954538319 Y: 7.9588318815438672 Z: 90
Without the voltage step and no offsets and using 3.0g I get the following:
X: -1.5322675849620377 Y: 4.7275420628731126 Z: 30.242639723333181 X: -1.6582412247915879 Y: 4.4327759196193295 Z: 29.275597460743235 X: -1.7842228834621141 Y: 4.6433107105722939 Z: 29.951543350138909 X: -2.0362127006474937 Y: 5.0645717506580912 Z: 28.795508763249902 X: -1.6162491506822376 Y: 4.7696615680989565 Z: 29.516487394448284 X: -1.3643141506658361 Y: 5.106712577007734 Z: 28.891348373149537 X: -1.7002341898803937 Y: 5.0645717506580912 Z: 29.323729867577644
First, I don't think I should be converting Z to an angle since it is the measure of gravity. The XL does have multiple settings to be able to switch it to 6g instead of 1.5g. I can change it, but I'm running out of digital ports. I am using most of the digital ports for the lcd.
Noob question:
How do I get more digital I/O ports?
Thanks