12V battery meter with Arduino MEGA

Before continue with codding, assuming you do have 4 cells of LifePO4, I think your volt range (12.8-10.7) is wrong.
I suspect it should be 11.2-14.6V. You better verify this point before blow-up your battery.