Is there a class/library that encompasses both hardware and software serial port


a long time ago (arduino 022), developed class library hardware device uses normal serial interface. @ time, there softserial (official) , newsoftserial (better) library available, , of course built-in hardware serial port on arduinos. then, wasn't possible write 1 library allow either type of interface device. in intervening years, , used newsoftserial becoming softwareserial, has situation improved? there way develop class derives whichever type of serial interface user has available, can pass in reference of sort serial interface wish use communicate supported device?

yes, it's called "stream".  stream class parent class of many of serial , serial-like devices:

code: [select]

$ grep -r ": public stream" *
api/hardwareserial.h:class hardwareserial : public stream
api/udp.h:class udp : public stream {
api/client.h:class client : public stream {
api/usbapi.h:class serial_ : public stream
libraries/wire/wire.h:class twowire : public stream
libraries/gsm/gsm3smsservice.h:class gsm3smsservice : public stream
libraries/sd/sd.h:class file : public stream {
libraries/softwareserial/softwareserial.h:class softwareserial : public stream


Arduino Forum > Using Arduino > Programming Questions > Is there a class/library that encompasses both hardware and software serial port


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support