I agree with the suspicious others, as there is a rule that the problem nearly always is where the user thinks it isn't.
That is very true. When you finally track down a stubborn problem it is always in the bit that is “obviously” right. So -
seems no problem with the wiring, like i said it work when its conecthed to the computer. think the problem is with my code..
It is the same code running, you have to go some to write code that will work when connected to the computer and will not work when it is not. It is not something that happens by accident, it is only something where you are asking the computer to do something and are waiting for a reply.