if (val++)
This statement will evaluate the value of val and will return false if it is zero or true if it is any other value. Once evaluated the value of val will be incremented. This is not what you need to do at all
Instead, each time you read the pot you need to compare the current value with the previous value to determine whether it has increased or decreased and save the current value as the previous value ready for the next time the check is done