Comments (3)
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.
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.
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)
- Note on wider applicability and compatibility HOT 6
- SLIPPacketSerial send() gives me two 0xc0 as the end of packet HOT 4
- Set Packet Handler to member function HOT 3
- Compatible with Teensy?
- Raspberry Pi Support HOT 1
- Serial is not sending data HOT 2
- Sending over serial stops HOT 2
- [No-BUG] Any idea why I get invalid packages? HOT 1
- Seeing strange behavior ... looking for thoughts ... HOT 2
- myPacketSerial.send() or myPacketSerial.update() does not return an error? HOT 1
- How to properly specify a larger buffer size? HOT 2
- Packet not received HOT 5
- Sending empty (0-byte) data HOT 3
- Callback supporting member function
- Low Baud Rate
- Add CRC checksum HOT 1
- Teensy 3.2 - reverse echo example not echoing HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packetserial.