Is my data collected properly in code?

Have you tested the components individually? If not get each device working separately first then attempt to combine everything.