Example code not working (wire.write and wire.read)

You don't need to do that. The wire library is included with the IDE.