Skip to main content
Arduino

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Draft saved
Draft discarded
Cancel
14
  • 1
    First, try looping back the Arduino's RX/TX lines to verify you do not have a full verses half duplex problem. Commented Jun 25, 2017 at 13:16
  • 1
    I'm still looking around. When looping back, you are depending on the Atmel processor hardware to buffer up received data while your software is busy transmitting it. Then you are depending on the Arduino serial libraries to get that buffered data (if there is any) after the it was already received. It is like talking and listening at the same time. Instead of the usual taking then listening in turn. Commented Jun 25, 2017 at 13:24
  • 1
    I am fairly sure the UART connected pins are similar or the same as GPIO. Interestingly, I can't find an exact match to this problem (if in fact it is a problem). Most use the UART to send messages followed by and EOL like an '\n". So they write sketches which expect to talk in turn. You, on the other hand, probably need to write a sketch which will work byte by byte. This assumes the Atmel processor you are using can only buffer 1 UART byte. Take a look at "Serial.readBytes()" to get some ideas. This is a long way to go just to test the optical coupler. Commented Jun 25, 2017 at 13:35
  • 1
    Perhaps I should add. In the real world, I would write an interrupt routine to handle the received data. All it would do is maintain a buffer of received data that is long enough to contain any expected messages until I could get around to reading it. So when I'm off sending data I will not miss any data being sent to me. I am not sure how the Arduino serial libraries are written. But they need to be simple so as to be small and compatible with as many other Arduino libraries as possible. Commented Jun 25, 2017 at 13:40
  • 1
    R2 and R3 form a voltage divider that prevents a proper high voltage; you have to connect the LED to 5V as shown in Transistor's answer. And the real MIDI circuit has more than one 220 Ω resistor; you can increase R1 to 1 kΩ. Anyway, for loopback testing, a direct connection 11 → 9 is OK. Commented Jun 25, 2017 at 14:14

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /