added function displayState
modified function checkSensor for 9 fields
implemented switch case statement in loop()