I've published the code for both master and slave in attachment to this post (see the .pde files at the end).
More information about formatting options
Code in attachment
I've published the code for both master and slave in attachment to this post (see the .pde files at the end).