Modified to compile for Arduino