updated for use with Arduino 1.0 IDE, added optional cached mode