Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Hideaki Tai committed Mar 23, 2018
1 parent 1e4a87e commit cabec31
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 30 deletions.
67 changes: 43 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# ArduinoOSC
OSC library for Arduino (ESP, Teensy, etc.)

OSC library for Arduino (ESP, Teensy, AVR, etc.)

ArduinoOSC is OSC Library for Arduino, based on the great work [ArdOSC]().
Though [ArdOSC]() can only be used with EthernetShield, ArduinoEthernet or device with W5100, this library expands the supported streams to WiFi, Ethernet, Serial (TBD), and the others which are derived from Stream class.
For the [ArdOSC]() License, See ArduinoOSC/avr/Lisence.txt

## Usage

### via ```WiFiUdp```

``` c++
#include <WiFi.h>
#include <WiFiUdp.h>
#include <ArduinoOSC.h>

WiFiUDP udp;
ArduinoOSC<WiFiUDP> osc;

const char* ssid = "your-ssid";
const char* pwd = "your-password";
const char* host = "xxx.xxx.xxx.xxx";
Expand All @@ -22,7 +26,6 @@ const int send_port = 12000;

void setup()
{
Serial.begin(115200);
WiFi.begin(ssid, pwd);
osc.begin(udp, recv_port);
osc.addCallback("/ard/aaa", &callback);
Expand All @@ -35,54 +38,70 @@ void loop()

void callback(OSCMessage& m)
{
// get osc data

// remote ip address
IPAddress sourceIp = m.getIpAddress();
//get 1st argument(int32)
Serial.print("arg 0 : ");
Serial.println(m.getArgAsInt32(0));
//get 2nd argument(float)
Serial.print("arg 1 : ");
Serial.println(m.getArgAsFloat(1));
//get 3rd argument(string)
Serial.print("arg 2 : ");
Serial.println(m.getArgAsString(2));

// send osc data

//create new osc message
OSCMessage msg;
//set destination ip address & port no
msg.beginMessage(sourceIp, send_port);
//set argument

// read & set same argument
msg.setOSCAddress("/ard/aaa");
msg.addArgInt32(m.getArgAsInt32(0));
msg.addArgFloat(m.getArgAsFloat(1));
msg.addArgString(m.getArgAsString(2));
//send osc message

// send osc message
osc.send(msg);
}
```
### via ```Serial```
## Notation
```c++
#include "ArduinoOSC.h"
ArduinoOSCSerial osc;
only loopback.ino with ESP32 module can be run in example folder
void setup()
{
osc.begin(Serial, 115200);
osc.addCallback("/ard/aaa", &callback);
delay(5000);
}
void loop()
{
osc.parse();
}
void callback(OSCMessage& m)
{
//create new osc message
OSCMessage msg;
msg.beginMessage();
// read & set same argument
msg.setOSCAddress(m.getOSCAddress());
msg.addArgInt32(m.getArgAsInt32(0));
msg.addArgFloat(m.getArgAsFloat(1));
msg.addArgString(m.getArgAsString(2));
//send osc message
osc.send(msg);
}
```

## Supported Communication Library

- WiFiUdp (ESP)
- EthernetUDP
- Serial
- Serial (Max7 example included)


## Tested Platform

- EPS32 w/ arduino-esp32
- Teensy 3.2, 3.5, 3.6
- Arduino Uno


## Limitation for AVR Platforms

- OSC packet size is limited to 128 bytes
Expand Down
12 changes: 6 additions & 6 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=ArduinoOSC
version=0.0.1
author=Hideaki Tai
maintainer=Hideaki Tai
sentence=OSC library for Arduino (ESP, Teensy, etc.)
paragraph=OSC library for Arduino (ESP, Teensy, etc.)
version=0.1.0
author=hideakitai
maintainer=hideakitai
sentence=OSC library for Arduino (ESP, Teensy, AVR, etc.)
paragraph=OSC library for Arduino (ESP, Teensy, AVR, etc.)
category=Communication
url=https://github.com/hideakitai/ArduinoOSC
url=https://github.com/hideakitai
architectures=*

0 comments on commit cabec31

Please sign in to comment.