Go Down

Topic: No begin in Stream, how to handle soft and hard serials as one general class? (Read 817 times) previous topic - next topic


I am trying to write code that can take either software or hardware serial object (arduino 1.0) and use it for communication. I'm aware that both inherit from Stream but after checking out the Stream code, I didn't find begin. Read, available are both there. I suppose the print and write are inherited from Print.

So my options are:
* Split into one function that does soft serial with a begin and another function that does hard serial with a begin.
* Demand the port to be initialized with a begin before the code can accept the pointer to the port and have one function to handle both initialized (begun) soft and hard serial ports.
* Any more elegant ways? Thank you!!!
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131