OSC - Processing to M5STRCK
processing和arduino之间的WIFI连接以及OSC协议通信,需保证在共同WIFI环境下连接。
arduino侧注意以下代码为必须,切勿遗漏。
osc.begin(udp, recv_port);
OSCMessage msg;
msg.beginMessage(host, send_port);
msg.setOSCAddress("/test");
msg.addArgInt32(Time);
OSC通讯根据/test 来区分不同信息,类似于buffer。
监听与发送IP,端口保持一致。
● processing to M5STACK
processing
/**
* oscP5sendreceive by andreas schlegel
* example shows how to send and receive osc messages.
* oscP5 website at http://www.sojamo.de/oscP5
*/
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
void setup() {
size(400,400);
frameRate(25);
/* start oscP5, listening for incoming messages at port 12000 */
oscP5 = new OscP5(this,12000);
/* myRemoteLocation is a NetAddress. a NetAddress takes 2 parameters,
* an ip address and a port number. myRemoteLocation is used as parameter in
* oscP5.send() when sending osc packets to another computer, device,
* application. usage see below. for testing purposes the listening port
* and the port of the remote location address are the same, hence you will
* send messages back to this sketch.
*/
myRemoteLocation = new NetAddress("192.168.10.2",12000);
}
void draw() {
background(0);
}
void mousePressed() {
/* in the following differen