oscP5 for the APDE

For the APDE app to work with oscP5, it requires a full structured library with a dex.jar, So I build this new jar and you can download it [here]. Just unzip the file into the Sketchbook/libraries folder. Below, a code for simultaneous interaction between two devices or PC. It’s pretty fast and suitable for a ping pong game. (Anyone feels challenged?)

import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress remoteLocation;
int x, y;

void setup() {
  size(400, 400);
  oscP5 = new OscP5(this, 12000); 
  remoteLocation = new NetAddress("192.168.25.4", 12000); // 192.168.25.4 has to be the IP of the other phone/PC
  fill(0);
}

void draw() {
  background(255);  
  ellipse(x, y, 10, 10);
}

void oscEvent(OscMessage m) {
  // if(m.checkAddrPattern("/tes") == true) {
  //  if(m.checkTypetag("ii")) { 
  x = m.get(0).intValue(); 
  y = m.get(1).intValue();
  // }  
  //}
}

void mouseDragged() {
  oscP5.send("/tes", new Object[] {new Integer(str(mouseX)), new Integer(str(mouseY))}, remoteLocation);
}

/*
 Address patterns in the OSC protocol are used as "labels" to switch/direct easily to different functions
 using "checkAddrPattern(/yourLabel)"
 The typetag is actually a string containing the order and amount of data types that you use in 
 the Object[] parameters. For instance; "ifs" means three parameters in object respectively, int, float, and string 
 */
1 Like

3 posts were split to a new topic: Posts in Gallery vs platform/language mode

Thank you.
I will try this code and response to you

@noel – Thank you so much for making and sharing this. Any chance that you could release this through a hosted code sharing site, e.g. github? I’d love to save a copy as a community resource.

There’s something very cool here. I’m running processing in linux ,but ,but on a chromebook. One big problem with that is that there is no connecting serial devices to programs running in linux. I can program/upload apk’s over USB with processing(android mode) or with Android Studio though.

Will this library allow me to connect a processing sketch to an android device as if it is a serial connection?

1 Like

Hi.
It’s not my lib, I just added the for APDE necessary dex.jar
I mostly use bluetooth for connection between my stm-32 processors, PC and tablet.
Depending on how much memory you have; in principle you can reprogram your Arduino boards over bluetooth or wifi. But maybe it’s easier to use ArduinoDroid with an otg cable, to directly program with your tablet/phone. I write code on my PC and use Pigeon to transfer it to my tablet’s clipboard. This way it compiles my programs in seconds using APDE. The same thing you can do with ArduinoDroid.

1 Like

Kindly tell me What’s a Pigeon? How can I use it?

By installing this Chrome extension on your PC and this app on your Android phone/tablet, everything you copy will be wifi transferred to the clipboard of the other device (bi-directionally). Just select all your IDE content, copy here, paste there, and there you go.

1 Like

Thank You Very Much for the Kind Information.