ShortPress = true;
ShortPress = false;
Can't make your mind up, it seems
pinMode(ButtonPin, INPUT_PULLUP);
while (digitalRead(ButtonPin))
{
i++; // how much the button has been held
}
The input will be HIGH (ie true) most of the time so i will increase very rapidly. Is that what you want to happen ? Will ShortPress be true or false most of the time ?
What do you intend the State variable to do considering that it start off as 0 (ie false) and is never changed ?