Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@chrisl: yes, that's what I see and how I interpret the data. Do I get it right that this should only happen with a dedicated sensor library, where the implementation knows how much data to expect? In case of a more generic I²C implementation, the master would not know how much data there is to read and thus would not stop the transmission?
Are you sure you don't have enough memory? How likely is it? Are you going to manufacture tens of thousands of it, or could you just buy a chip with more memory? Otherwise I'd say that's premature optimization.
That commented /* ... */ music stuff is distracting. Why do you keep it? Would you mind creating a copy of your program and remove everything that is not related to the button problem, e.g. the LCD intro in setup(). That would help as well.