1

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!

6
  • 1
    What board are you compiling for? – Majenko May 28 at 16:07
  • thisBoardsSerialUSB is merely a placeholder for whatever the USB serial connection is for your board. Some have it as Serial, some USBSerial. It's up to you to put the right thing in. – Majenko May 28 at 16:42
  • there is #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__)) – Juraj May 28 at 16:44
  • @Majenko Ah okay! I read into the example code a bit too literally! the board I'd like to use is the Adafruit Metro M0 Express, which uses a ATSAMD21G18 chip (an ARM Cortex M0+) – d.bonbon May 28 at 17:12
  • 1
    SAMD21 should work: || defined(_SAMD21_) – Juraj May 28 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.