|Nasser M. Abbasi|
I could not understand what you are actually trying to do in your code.
First, you start by doing Clear["Global`*"]; then follow that by doing Which[y[t] == 0, u = 10, y[t] == 10, u = -10].
How can y[t] have any value at this point? You just did Clear["Global`*"] just before that?
You also seem to mix definitions of functions. at one point you used := and for another you used =.
These are not the same. You should use := for adj function.
I would like recommend to break your notebook into cells. Do each command in one cell, then look at the output of that command. Then go to the next command. This makes it easier for you to find an error, rather than put all the commands in one big cell and run it all as one command.
The function definitions can go in one cell, but the commands better be each in its own cell to help you find a problem.
To help debug, try each one command on its own, make sure it works. For example, call your sol[r_] function as a stand along, to make sure it does what you want. Do the same for adj, before putting everything together.
Will look more into your code when I have more time.