diff --git a/src/gp2y0a/gp2y0a.cxx b/src/gp2y0a/gp2y0a.cxx index 6943d0b9..07abc7d3 100644 --- a/src/gp2y0a/gp2y0a.cxx +++ b/src/gp2y0a/gp2y0a.cxx @@ -23,6 +23,8 @@ */ #include +#include +#include #include "gp2y0a.h" @@ -33,7 +35,8 @@ GP2Y0A::GP2Y0A(int pin) { if (!(m_aio = mraa_aio_init(pin))) { - cerr << __FUNCTION__ << "mraa_aio_init() failed." << endl; + throw std::invalid_argument(std::string(__FUNCTION__) + + ": mraa_aio_init() failed, invalid pin?"); return; }