How to write API code in arduino