progran not save in mu arduino mega board

Currently I have complete a arduino midi drum like drum kit kit, it runs very well but problem when shut down my PC, arduino don’t work, it again work when I upload the sketch again. Please solve it…

It appears your arduino has a dependency to your PC. Either power or some data communications?

Are you powering the Arduino via the USB cable perhaps...?

If no: Post your code and a schematic of your setup.

yes my arduino is powered by USB.

i have attached my code and schematic. Actually i have used 8 piezo from A0 to A7 used red pin and every pieazo is GND with black pin. for every piezo i used 1M resistance & 5.1v Zen Diode in parallel to piezo.


DrumKitV1b.ino (4.79 KB)

Perhaps i'm stating the obvious, but if you power your arduino from the USB and you shut off your computer, the power to the arduino will be cut off.

Try using a normal power supply.