As is explained in the million or so other threads that ask essentially the same question, you can consult a local lawyer about any diversion or deferral programs available in your area, and whether you qualify, and you can discuss with your lawyer any other ways you may be able to avoid a criminal conviction. You can see if you qualify for a court-appointed lawyer.

