when a key is pressed, the 'state' of the key is set to 1 to signify ON. When the key is released it is set to 0 for OFF.