Hi all,
I would like to use a few teensys with OSC.
With my current setup, the helpful guidelines, and the attached code, I am able to receive OSC messages on my laptop from the Teensy. But, after fiddling around and looking at the forums, I am still not able to receive OSC messages from my max/patch to my Teensy 3.2(although the IP and port are a match).
Here is my current setup:
I have a USB to Ethernet adaptor (from apple) that connects my WIZ820io ethernet module with my computer. I successfully wired the WIZ820io ethernet module with my Teensy 3.2 on a breadboard, according to the guideline on Teensy's website. The teensy is powered through USB and the ethernet module with an external power supply. The grounds are connected.
I have attached a few images and the code I am currently using to test, in case it is of help.
I would really appreciate it if anybody has any insights or solutions for the problem I am currently facing.
Here is the code I am using for the Teensy:
Here is the max patch:
View attachment Wavefunction_OSC_software.zip
And here are the pictures of my connections:
Thank you for your time
I would like to use a few teensys with OSC.
With my current setup, the helpful guidelines, and the attached code, I am able to receive OSC messages on my laptop from the Teensy. But, after fiddling around and looking at the forums, I am still not able to receive OSC messages from my max/patch to my Teensy 3.2(although the IP and port are a match).
Here is my current setup:
I have a USB to Ethernet adaptor (from apple) that connects my WIZ820io ethernet module with my computer. I successfully wired the WIZ820io ethernet module with my Teensy 3.2 on a breadboard, according to the guideline on Teensy's website. The teensy is powered through USB and the ethernet module with an external power supply. The grounds are connected.
I have attached a few images and the code I am currently using to test, in case it is of help.
I would really appreciate it if anybody has any insights or solutions for the problem I am currently facing.
Here is the code I am using for the Teensy:
Code:
#include <OSCMessage.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>
#include <OSCMessage.h>
#include <OSCBundle.h>
#include <OSCBoards.h>
#pragma GCC diagnostic ignored "-Wwrite-strings"
/*******************SETUP OSC********************/
EthernetUDP Udp;
//255.255.255.255 is the IP to broadcast to all devices in the network
IPAddress ip(10, 0, 1, 2);
IPAddress outIp(10, 0, 1, 1); //destination IP
const unsigned int outPort = 6789;
const unsigned int inPort = 8979;
byte mac[] = { 0x04, 0xE9, 0xE5, 0x03, 0x94, 0x5E }; // you can find this written on the board of some Arduino Ethernets or shields, for Teensy we have custom made code - implement it
void setup() {
Serial.begin(115200);
Ethernet.begin(mac,ip);
Udp.begin(inPort);
}
void loop(){
//the message wants an OSC address as first argument
sendOSCMessage("/speed", 2, outIp, outPort);
OSCMsgReceive();
}
void sendOSCMessage(char *addr_pattern, int mtr_id, IPAddress ip_, int port_){
OSCMessage msg_recv(addr_pattern);
msg_recv.add((int32_t)mtr_id);
msg_recv.add((int32_t)analogRead(A14));
Udp.beginPacket(ip_, port_);
msg_recv.send(Udp); // send the bytes to the SLIP stream
Udp.endPacket(); // mark the end of the OSC Packet
msg_recv.empty(); // free space occupied by message
}
void OSCMsgReceive(){
OSCBundle bundleIN;
int size;
//Serial.println(Udp.parsePacket());
if( (size = Udp.parsePacket())>0)
{
while(size--)
bundleIN.fill(Udp.read());
if(!bundleIN.hasError())
bundleIN.route("/input", inputfunction);
}
}
void inputfunction(OSCMessage &msg, int addrOffset){
int value = msg.getInt(0);
Serial.print("Value = : ");
Serial.println(value);
}
Here is the max patch:
View attachment Wavefunction_OSC_software.zip
And here are the pictures of my connections:
Thank you for your time