Added "write" eventemitter to improve logging output and added a serial example