Program doest work with sprintf

You have used a quarter of your RAM on space for str. IIRC, the wire library uses quite a bit too - your issue therefore may be that you're out of memory - try making it (much) smaller.