2 Suggestions for Serial Library

08 Jan 2012

Hey guys! I am working with the Serial Library at the moment and I have got two suggestions for this class.

1.) A Method called write, taking a pointer to a char array and a number of bytes. Then it is sending putc-like all chars in the char array. ATM i use this method for it:

void SerialWrite(Serial & S, const char * pBuffer, int NumBytes)
{
    //Send Data
    for(int i= 0; i < NumBytes; i++)
        S.putc(Buffer[i]);
}

2.) An other Attach-method, that is not calling the attached callback function every time a new byte is coming in. Instead it should buffer until a special char is coming in. This would be usefull, when you are working with GPS devices using the NMEA standard for example. Those devices are sending packets beginning with '$' and ending with '\n'. The project "processing" based on Java has such functionality.

Is it possible for you to add such code?

09 Jan 2012

Check the cookbook page and look for modserial and modgps.

Mike