Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
example-processing.h
00001 /* EXAMPLE SEND/RECEIVE on PROCESSING: 00002 00003 // oscP5sendreceive by andreas schlegel 00004 // example shows how to send and receive osc messages. 00005 // oscP5 website at http://www.sojamo.de/oscP5 00006 00007 */ 00008 00009 import oscP5.*; 00010 import netP5.*; 00011 00012 OscP5 oscP5; 00013 NetAddress myRemoteLocation; 00014 00015 void setup() { 00016 size(400,400); 00017 frameRate(25); 00018 // start oscP5, listening for incoming messages at port 12000 00019 oscP5 = new OscP5(this,12000); 00020 00021 // myRemoteLocation is a NetAddress. a NetAddress takes 2 parameters, 00022 // an ip address and a port number. myRemoteLocation is used as parameter in 00023 // oscP5.send() when sending osc packets to another computer, device, 00024 // application. usage see below. for testing purposes the listening port 00025 // and the port of the remote location address are the same, hence you will 00026 // send messages back to this sketch. 00027 myRemoteLocation = new NetAddress("10.0.0.2",10000); 00028 } 00029 00030 00031 void draw() { 00032 background(0); 00033 } 00034 00035 void mousePressed() { 00036 // in the following different ways of creating osc messages are shown by example 00037 OscMessage myMessage = new OscMessage("/mbed/test1"); 00038 00039 myMessage.add(123); // add an int to the osc message 00040 00041 // send the message 00042 oscP5.send(myMessage, myRemoteLocation); 00043 } 00044 00045 00046 // incoming osc message are forwarded to the oscEvent method. 00047 void oscEvent(OscMessage theOscMessage) { 00048 // print the address pattern and the typetag of the received OscMessage 00049 print("### received an osc message."); 00050 print(" addrpattern: "+theOscMessage.addrPattern()); 00051 println(" typetag: "+theOscMessage.typetag()); 00052 }
Generated on Wed Jul 13 2022 04:37:12 by
1.7.2