Code Monkey home page Code Monkey logo

Comments (3)

bakercp avatar bakercp commented on September 18, 2024

Hey there, sorry for the slow reply. There currently isn't a really elegant way to do this. When I have done it in the past, I actually didn't use the PacketSerialSLIP code on the Arduino, I just used the OSC code exclusively as it was designed. Since they both use the SLIP protocol, it should work. If you want to use the Arduino SLIP code that comes with this library, then your method is probably the best way. If you don't want to modify the library, you could configure your Arduino side with the setStream(...) method. See the example here. Then you will have easy access to a local member that represents the underlying Serial object. Ultimately PacketSerial just wraps up Serial, Serial1, Serial2, etc by default, but allows you to use SoftwareSerial or anything else with the Ardyino Stream interface. See this for a little example:

https://github.com/bakercp/PacketSerial/blob/master/src/PacketSerial.h#L141-L172

I'd prefer that the Arduino OSC library just make its bytes read/writeable but I believe it avoids that so it doesn't have to buffer a bunch of memory. An alternative would be to add a getter like you've done to PacketSerial and maybe startPacket() and endPacket() method or something ... though that starts to mix paradigms in ways that may be confusing. Feel free to propose ideas!

from packetserial.

orgicus avatar orgicus commented on September 18, 2024

Hi Chris,

No worries at all and thank you for the detailed reponse.

I personally ran into some issue with the OSC library's SLIP encoding and it felt a little slower/less reliable than using OSC via PacketSerial's SLIP encoding.

I've already tweaked the library to add a getter.

I'm not 100% I understood the setStream(...) option. Would that be swapping between setting the stream to be Serial instance in use or the OSCMessage instance ?

I would also prefer the OSC library exposed it's bytes.
Your suggestion with startPacket() / endPacket() is nicer than my current approach.

Let me know if this useful (and if so how I should re-write the above example for clarity) and I can submit a pull request. If you're rather keep the library as is and not tie it to OSC this way I can totally get that :)

Thank you,
George

from packetserial.

bakercp avatar bakercp commented on September 18, 2024

Hey @orgicus I've been thinking about this on and off since you posted and I think for now, I'm going to keep the examples disconnected from OSC, etc. I did incorporate your getter method into the 1.4.0 release though. Thanks!

from packetserial.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.