Hey I'm trying to test out the CMAT/OSC library for Arduino and just want to get up and running sending SLIP encoded OSC messages. I've been able to observe the typical Serial monitor when sending OSC Messages that way, but I cannot seem to get the example code to compile:
#include <SLIPEncodedSerial.h>
#include <OSCData.h>
#include <OSCBundle.h>
#include <OSCBoards.h>
#include <OSCTiming.h>
#include <OSCMessage.h>
#include <OSCMatch.h>
#include <SLIPEncodedUSBSerial.h>
SLIPEncodedUSBSerial SLIPSerial( thisBoardsSerialUSB );
// SLIPEncodedSerial SLIPSerial(Serial);
void setup() {
//begin SLIPSerial just like Serial
SLIPSerial.begin(9600); // set this as high as you can reliably run on your platform
}
void loop(){
//the message wants an OSC address as first argument
OSCMessage msg("/address");
msg.add("Hello World\n");
;
SLIPSerial.beginPacket();
msg.send(SLIPSerial); // send the bytes to the SLIP stream
SLIPSerial.endPacket(); // mark the end of the OSC Packet
msg.empty(); // free space occupied by message
delay(20);
}
Furthermore this is the output error I see:
error: 'SLIPEncodedUSBSerial' does not name a type; did you mean 'SLIPEncodedUSBSerial_h'?
10 | SLIPEncodedUSBSerial SLIPSerial( thisBoardsSerialUSB );
| ^~~~~~~~~~~~~~~~~~~~
| SLIPEncodedUSBSerial_h
exit status 1
'SLIPEncodedUSBSerial' does not name a type; did you mean 'SLIPEncodedUSBSerial_h'?
Could someone lend some clarity on what "thisBoardsSerialUSB" and "Serial" are in this context? I thought that the SLIPEncodedSerial / SLIPEncodedUSBSerial constructors simply take a reference. This might be trivial, but I am not sure how to properly instantiate these classes within the Arduino IDE.
Cheers!
thisBoardsSerialUSB
is merely a placeholder for whatever the USB serial connection is for your board. Some have it asSerial
, someUSBSerial
. It's up to you to put the right thing in.#if (defined(TEENSYDUINO) && defined(USB_SERIAL)) || (!defined(TEENSYDUINO) && defined(__AVR_ATmega32U4__)) || defined(__SAM3X8E__) || (defined(_USB) && defined(_USE_USB_FOR_SERIAL_)) || defined(_SAMD21_) || (defined(__PIC32MX__) || defined(__PIC32MZ__))
|| defined(_SAMD21_)