In this paper we study numerically solving optimal control problems with bang-bang control functions. We present a formal Lagrangian approach for solving the optimal control problem, and address difficulties encountered when numerically solving the state and adjoint equations by using the immersed interface method. We note that our numerical approach does not approximate the discontinuous control function with smooth functions, instead we solve the true bang-bang optimal control problem. Our approach for solving the optimal control problem uses an adjoint-based gradient. We use the gradient in our first-order trust-region method to generate a local minimizing control. We present detailed numerical results to demonstrate the effectiveness of our method