# APDE USB / OTG communication

**URL:** <https://discourse.processing.org/t/apde-usb-otg-communication/30114>\
**Category:** Processing for Android\
**Created:** [May 16, 2021, 12:13am UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114 "2021-05-16T00:13:07Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 18, 2021, 6:48pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/41 "2021-05-18T18:48:22Z")

</div>

@ZENAR57 have you mange how to import libraries with apde 5.1 ? if not back to the past topic there is how to do it

---

<div class="post-metadata">

**Author:** ![ZENAR57](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@ZENAR57](https://discourse.processing.org/u/ZENAR57)\
**Post date:** [May 18, 2021, 7:01pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/42 "2021-05-18T19:01:14Z")

</div>

5.1 alpha-No  
5.2betta-good

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 18, 2021, 7:02pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/43 "2021-05-18T19:02:40Z")

</div>

> [@ZENAR57](#):
>
> 5.1 alpha-No

read the last topic for 5.1

---

<div class="post-metadata">

**Author:** ![ZENAR57](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@ZENAR57](https://discourse.processing.org/u/ZENAR57)\
**Post date:** [May 18, 2021, 7:11pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/44 "2021-05-18T19:11:20Z")

</div>

just tried 5.1 beta … also does not work.but there is an option to install libraries at 5.2.then remove 5.2 and put 5.1 all libraries are saved.

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 18, 2021, 7:14pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/45 "2021-05-18T19:14:44Z")

</div>

> [@paulgoux](#):
>
> here it is as a jar, also the eclipse files should you wish to amend the build.

nice work but as for me i can not dive deep because i have other electronics interests my aim from processing programming is to make controls with Arduino and microelectronics

i can learn from 2 or 3 example of certain point if i stuck with some issues, if i couldn’t i ask here and there is a lot of good guys willing help

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [May 18, 2021, 7:27pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/46 "2021-05-18T19:27:34Z")

</div>

thats cool, didn’t know if it would be helpful or not.

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 18, 2021, 7:30pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/47 "2021-05-18T19:30:54Z")

</div>

it is for sure many others figuring out multi issues and you are posting good and helpful point

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 19, 2021, 3:09am UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/48 "2021-05-19T03:09:24Z")

</div>

i modify it to run via OTG

> **[Radar (SONAR) Using Processing 3](https://www.hackster.io/Yug_Ajmera/radar-sonar-using-processing-3-7302c6)**
>
> We are using an ultrasound sensor that emits a signal and takes a reading which is displayed on screen using Processing 3. By Yug\_Ajmera.

 ![Screenshot_2021-05-19-06-05-36-139](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/74a633d0c9090f3f3a3d7abe2819307ef7716ef7.jpeg)  
 ![Screenshot_2021-05-19-06-04-42-338](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/dbca0a5606fe0071621fd85f76cfedfe41c81a63.jpeg)

---

<div class="post-metadata">

**Author:** ![ZENAR57](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@ZENAR57](https://discourse.processing.org/u/ZENAR57)\
**Post date:** [May 19, 2021, 12:10pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/49 "2021-05-19T12:10:48Z")

</div>

great, very interesting.I checked in there right away.thank you very much for the helpful information.

---

<div class="post-metadata">

**Author:** ![ZENAR57](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@ZENAR57](https://discourse.processing.org/u/ZENAR57)\
**Post date:** [May 19, 2021, 12:52pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/50 "2021-05-19T12:52:57Z")

</div>

**APDE 5.1 latest beta**

> **device\_filter.xml- ok**
>
> ![Polish_20210519_154034047](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1500b95d3c9d8288ec40a4de1e8ff8f53a432392.jpeg)

> **manifest**
>
> ![Polish_20210519_154704761](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/ddcb3bc47f627801a692f981243b280dd59e361b.jpeg)

---

<div class="post-metadata">

**Author:** ![ZENAR57](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@ZENAR57](https://discourse.processing.org/u/ZENAR57)\
**Post date:** [May 21, 2021, 4:35pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/51 "2021-05-21T16:35:36Z")

</div>

![Screenshot_20210521_191432](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/ac5d194bc059990e28eb360781efecb10da3c8f4.jpeg)  
Ok  
.  
.  
.  
 ![Screenshot_20210521_192956](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f17174dad581956ffdcc304250b4649bb24b638f.jpeg)

> **[Release 0.1.0-alpha · inventit/processing-android-serial](https://github.com/inventit/processing-android-serial/releases/tag/0.1.0-alpha)**
>
> //github.com/inventit/processing-android-serial/releases/tag/0.1.0-alpha

 ![Screenshot_20210521_193227](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/075783822e51f4bec42020020f2cd177dd097158.jpeg)  
 ![symbols_over_mouth_animated_sticker](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c7018c02280c36a2d44a0cd11f658e58633aebd9.gif)

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 21, 2021, 6:36pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/52 "2021-05-21T18:36:46Z")

</div>

if you got this then you made it

 ![Screenshot_20210521_191432](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/ac5d194bc059990e28eb360781efecb10da3c8f4.jpeg)

---

<div class="post-metadata">

**Author:** ![ZENAR57](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@ZENAR57](https://discourse.processing.org/u/ZENAR57)\
**Post date:** [May 21, 2021, 7:23pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/53 "2021-05-21T19:23:39Z")

</div>

but I getting wrecked a primitive polling of devices.  
.  
Serial.list (this) [0]  
.  
I put the library well, in manual mode, through dfx .  
.  
-glv- wrote that he also did it on the phone. but he did not indicate which library he was using.I have provided an annotation and a direct link to the library that I used. in my previous post. but I do not understand this library is needed, or another.

---

<div class="post-metadata">

**Author:** ![ZENAR57](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@ZENAR57](https://discourse.processing.org/u/ZENAR57)\
**Post date:** [May 21, 2021, 7:39pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/54 "2021-05-21T19:39:34Z")

</div>

Do I need it, or do I not need to install it additionally?

 ![Screenshot_20210521_223740_com.android.chrome](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c10418b9998a4f56b0c58e1737ff6fcfaf846c81.jpeg)

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 21, 2021, 8:09pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/55 "2021-05-21T20:09:07Z")

</div>

your sketch run good post it i think the crush you have is from the connected hardware explain what you did

---

<div class="post-metadata">

**Author:** ![ZENAR57](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@ZENAR57](https://discourse.processing.org/u/ZENAR57)\
**Post date:** [May 21, 2021, 8:31pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/56 "2021-05-21T20:31:17Z")

</div>

```auto
import org.slf4j.*;
import org.slf4j.helpers.*;
import com.yourinventit.processing.android.serial.*;
import com.hoho.android.usbserial.util.*;
import org.slf4j.spi.*;
import com.hoho.android.usbserial.driver.*;
import org.slf4j.impl.*;

Serial port;
int temp=1;
void setup(){
 if (Serial.list(this)[0] ==null){temp=0;}
//port = new Serial(this,Serial.list(this)[0],57600);
//port.bufferUntil('\n');
  size(800,800);
}

void draw (){
  fill(255, 0, 0);
  ellipse(100, 100, 100,100);
  text(temp, 300,300);
  
}

```

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 21, 2021, 8:32pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/57 "2021-05-21T20:32:53Z")

</div>

do you have Arduino or not ?

---

<div class="post-metadata">

**Author:** ![ZENAR57](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@ZENAR57](https://discourse.processing.org/u/ZENAR57)\
**Post date:** [May 21, 2021, 8:34pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/58 "2021-05-21T20:34:58Z")

</div>

Yes.  
Yes.  
Yes.  
Uno.  
through the terminals that are on the screenshots today, it works fine.

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 21, 2021, 8:43pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/59 "2021-05-21T20:43:05Z")

</div>

what is the serial driver chip or your Arduino ?

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 21, 2021, 8:48pm UTC](https://discourse.processing.org/t/apde-usb-otg-communication/30114/60 "2021-05-21T20:48:47Z")

</div>

this work with me using android mode did not crash

```auto
//////////////////////////////////////////////////////////
//
// supersimple application which sends 1 0 1 0 (toggle)
// after each mouse click to the serial
//
//
// basic infos
// ===========
// https://github.com/mik3y/usb-serial-for-android
// Lib for android > 3.1 to use the USB interface in host mode (OTG)
// https://github.com/inventit/processing-android-serial
// Processing wrapper for the usb-serial-for-android lib
//
import com.yourinventit.processing.android.serial.*;

Serial SerialPort;
boolean Toggle;

void setup()    
{
  println(Serial.list(this));
  
  // this simple initialisation works only when one Serial consumer (e.g. an Arduino)
  // is connected. Serial.list provides a list with all Usb Serial devices attached
  // to this machine.
  SerialPort = new Serial(this, Serial.list(this)[0], 9600);
}

void draw()
{

}

void mousePressed() {
  Toggle = !Toggle;
  SerialPort.write( Toggle?"1":"0");
}

```

[Previous page](https://discourse.processing.org/t/apde-usb-otg-communication/30114.md?page=2)

[Next page](https://discourse.processing.org/t/apde-usb-otg-communication/30114.md?page=4)
