If your value was increasing, then changed direction and decreased, without ever having been steady in between, wouldn't this set both pin 7 and pin 8 LOW?
Also, this would detect any change in val of more than .01, no? (because it's muliplying by 100 then truncating to an integer. aren't you...