Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 4 months ago.
The proper way to use Serial as my class member
I'd like to wrap a Serial member into my own class:
for example: in my myOBD.h file, define uart class member class myOBD { public: myOBD(PinName tx, PinName rx);
private: Serial uart; };
then, in myOBD.cpp, use member initializer list to intialize the uart with right TX and RX pin !! myOBD::myOBD(PinName tx, PinName rx) : uart(tx, rx) {};
but then, when I try to use the uart in other member function, it seems not working, anyone has some suggestions?
Thanks,
That is proper way, so you need to give more details.
posted by Erik - 23 Jul 2015Thanks Erik, I just confirmed on another mbed, it's working fine. So the original problem might be caused by hardware issue. Thanks!
posted by Hank Fang 23 Jul 2015