Implemented PiMessage write method