You need to speak with an attorney who can work on presenting a defense based upon you mental capacity and lack of ability to form the intent to commit a crime.
However, the fact that you chose not to take your medication will likely play against you since such delusions are probably a predictable result of your failure to take the medication.
Consult local counsel ASAP.

