When importing Arduino libraries, there are several housekeeping tasks involving Extern blocks and Delay functions you should perform for the code to run efficiently.
See Also:
Using the Extern Definition and Extern Function blocks
Delay functions