I am looking for a way to use OSC to communicate with my Arduino from my computer, in both directions. Every example Processing/Arduino sketch combo I have tried does not work out of the box.
I have used Arduino many times, as well as Processing, and am getting very stuck. Please help.
I want to do it in the easiest way possible. Just get the simplest message to send. I am using this library called OSCuino: http://cnmat.berkeley.edu/oscuino
Let’s start with sending information from my Arduino to my computer…
I am using this great network OSC sniffer provided here to watch for OSC messages on the appropriate port. I am watching the correct IP address, all the relevant ports, and am not seeing any messages. What am I doing wrong??
I have this code on my Arduino:
/*
Make an OSC message and send it over UDP
Adrian Freed
*/
#include <OSCMessage.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>
#include <OSCMessage.h>
EthernetUDP Udp;
//the Arduino's IP
IPAddress ip(128, 32, 122, 252);
//destination IP
IPAddress outIp(169, 254, 166, 0);
const unsigned int outPort = 9999;
byte mac[] = {
0x90, 0xA2, 0xDA, 0x0F, 0x2B, 0X1E
}; // you can find this written on the board of some Arduino Ethernets or shields
float vvv = 0.0;
void setup() {
Ethernet.begin(mac, ip);
Udp.begin(8888);
}
void loop() {
//the message wants an OSC address as first argument
OSCMessage msg("/analog/");
msg.add(vvv);
Udp.beginPacket(outIp, outPort);
msg.send(Udp); // send the bytes to the SLIP stream
Udp.endPacket(); // mark the end of the OSC Packet
msg.empty(); // free space occupied by message
delay(20);
vvv = vvv + 0.1;
}