Before you press k-key place the robot in different distance from the wall. Use program several times. Can you see green color? Add the wait block before if and try again.