Particle electron publish error

That is adaption from original code…

Discussion thread - Using an accelerometer and publishing when a sleeping Photon is moved

code source - https://github.com/rickkas7/AccelWake/blob/master/accelwake_electron.cpp

I am getting sensor value as high every alternate time( 00 1 1 001 1 001 1 ), I am confused about it.