I want to use my arduino mega without computer, so i need to buy an AC-to-DC adapter. In the hardware page: http://arduino.cc/en/Main/ArduinoBoardMega appears the input voltage recommended (7-12V).
I would get one between 0.5A and 1A. The Mega doesn't need that much only about 50mA but ll the stuff you can drive with it soon adds up so that sort of current rating will keep you going in the medium term.
So fundamentally there should be no difference. If the code works when powered from the USB then there is nothing wrong with the code.
So there is a problem with providing power externally.
What hardware board are you running?
Make sure it is working from the 9V by downloading and running the blinking LEDs.
Make sure you have connected the ground from you 9V to the ground of the Arduino and also the ground of your MIDI input interface. That is pin 4 on the opto isolator and the other end of the 100K resistor.
Check that there is 5V on your MIDI interface circuit with the 9V connected.
Make sure it is working from the 9V by downloading and running the blinking LEDs.
yes, it works.
Make sure you have connected the ground from you 9V to the ground of the Arduino and also the ground of your MIDI input interface. That is pin 4 on the opto isolator and the other end of the 100K resistor.
yes, checked.
I have not any voltimeter.. i can't check the third think..
well, i have a arduino mega, in that arduino the power source is selected automatically.
it works fine with codes like "blink". but it doesn't recieve MIDI messages with the circuit with octocoupler. I have done a AC/DV 5Vdc with a usb connexion and the arduino works well. has it any sense?
can it be possible that the 5V pin works well with USB connexion power supplies and wrong with the jack connexion?
can it be possible that the 5V pin works well with USB connexion power supplies and wrong with the jack connexion?
To put it bluntly no.
You need to see if the serial signal is getting on to your serial input pin. The best thing is to use an oscilloscope. If you haven't got one then an LED and resistor could show you. However you would be looking for occasional offs with normally on. This is hard to spot. If you could wire it up to an inverter first (like a 74LS04) then the LED would be showing off with occasional ons, this is very easy to spot.