Non-Blocking Wire Does I2C without pausing


The Non-Blocking version of the Wire library (1.0) is here:

There are two example sketches, Demo1 and Demo2. Unfortunately, these are written for the LSM303, the only I2C device that I have at the moment, so you probably can't run them as-is. I've made an effort to make the demo code comprehensible, but one man's comprehensible is another's incoherent. Read it at your own risk!

Demo1 is essentially straight from the original LSM303 demo, and uses the blocking versions of the NBWire library (endTransmission and requestFrom).

Demo2 shows how to use the non-blocking versions (nbendTransmission and nbrequestFrom). This entails splitting the original code into a sequence of functions where each registers the next as a callback (to be called back after whatever would have blocked execution).

You'll notice that the structure of the loop comes from BlinkWithoutDelay, the original exercise in non-blocking behavior.

Look in Demo2 for a description of what's going on in both demos.

If you have any ideas on how to make this easier to understand, send them along! You can reach me here, or at

Thumbs Up!
Gene Knight


is there going to be some update. Because the library is pretty good but does work for new ide.

Cheers Simon