adapted to Arduino \> 1.0