Arduino connection using USB OTG

Dear experts,

I am new into kodular and already love it :slight_smile:

I am currently a bit lost connecting to an arduino using a USB on-the-go cable and the Kodular “Arduino” connectivity component. Unfortunately I did not find any documentation about it. Is there any? I succeeded to send data from my mobile to the arduino. But I am struggeling with the way back, receiving data in the Kodular app that was sent from the arduino.

Is there anybody here who has that running?

Best regard from Aachen, Germany and many thanks in advance

You’ll have to dig a bit (lot) to find how it works. Look at the accepted answer for a working example.


The master himself! :slight_smile:
Thank you for the quiiiick reaction!

I am trying to do it like James_D but the AfterRead code is not executed, no matter what I do.

What I dont understand is the timing between “arduino sends” and “android calls read()”… Logically, is there some kind of buffer on the android side? Will it return something if called after the data was sent? Or is “read()” blocking and waiting until it receives something? Or is it necessary to call “read()” in an endless loop or controlled by a timer event to catch whatever was sent?

Thank you for any help!

I find it interesting that we can use OTG USB. But I am concerned that you will only see samples sending numbers, and not more complex code (almost like sending the complete firmware with customization on the fly)

In my case it is an application with an 8x8 panel that simulates an 8x8 RGB LED matrix, which I want to send the color and power data to each time I color a button (GRID -> Buttonx64)

1 Like