Try initializing totalVal to zero:
float totalVal=0.0;
You should try simpler projects first, so that you learn the language and special features of the Arduino. If you don't, expect the type of frustration you are currently having with a complex project to continue for a long time.