これを参考にするといい
http://www.musashinodenpa.com/arduino/ref/index.php?f=1&;pos=92