Question about library constructor
hello,
i making library current project.
i have following constructor in cpp file:
i want give user possibility choose between 2 inputs, 1 can used:
int serialportread (to read input or serial port) or char* datainput (to read content of string)
can use:
or there nifty on how this?
thanks in advance,
/me
i making library current project.
i have following constructor in cpp file:
code: [select]
//****constructor****
parsedata::parsedata(
char header[8],
char footer[8],
int serialportread,
int serialportwrite,
char* datainput,
void match(),
int maxinputlength,
boolean debug)
{
if (serialportread != null)
{
_serialportread = serialportread;
}
}i want give user possibility choose between 2 inputs, 1 can used:
int serialportread (to read input or serial port) or char* datainput (to read content of string)
can use:
code: [select]
if (serialportread != null) // check if entered @ serialportread position?
{
_serialportread = serialportread;
}
else
{
_datainput = datainput ;
}or there nifty on how this?
thanks in advance,
/me
what serialportread , serialportwrite used later?
the simplest thing in rest of code, check see if _datainput null. if is, no string read provided, therefore user wanted read serial port.
the simplest thing in rest of code, check see if _datainput null. if is, no string read provided, therefore user wanted read serial port.
Arduino Forum > Forum 2005-2010 (read only) > Software > Development > Question about library constructor
arduino
Comments
Post a Comment