Copyright GettingStartedwithArduinoandGo AgusKurniawan 1stEdition,2015 Copyright2015AgusKurniawan *CoverphotoiscredittoFajarRamadhany,Bataviasoft, http://bataviasoft.com/. **Arduinologoistakenfromhttp://www.arduino.cc/. TableofContentsPreface ThisbookwaswrittentohelpanyonewanttogetstartedwithArduinoandGo.It describesthebasicelementsoftheintegrationofArduinoandGo. AgusKurniawan Depok,March2015 1.PreparingDevelopmentEnvironment1.1Arduino Arduinoisanopen-sourceelectronicsprototypingplatformbasedonflexible,easy-to-use hardwareandsoftware.ThisboardusesAtmelmicrocontrollerseries.Therearemany Arduinohardwaremodelsthatyoucanuse.FurtherinformationaboutArduinoproducts, youcanvisitonwebsitehttp://arduino.cc/en/. YoumustoneArduinohardwaretofollowpracticesinthisbook.Irecommendtoobtain oneofthefollowingArduinohardware: ArduinoUno ArduinoLeonardo ArduinoMega2560 ArduinoDue Youcanbuythisproductonyourlocalelectronicstore.Youalsocanorderitbyonline. 1.1.1ArduinoUno TheArduinoUnoisamicrocontrollerboardbasedontheATmega328.Youcandownload thedatasheetfile, http://www.atmel.com/dyn/resources/prod_documents/doc8161.pdf. 1.1.1ArduinoUno TheArduinoUnoisamicrocontrollerboardbasedontheATmega328.Youcandownload thedatasheetfile, http://www.atmel.com/dyn/resources/prod_documents/doc8161.pdf.
FurtherinformationaboutArduinoUno,youcanreaditon http://arduino.cc/en/Main/ArduinoBoardUno. 
1.1.2ArduinoLeonardo TheArduinoLeonardoisamicrocontrollerboardbasedontheATmega32u4.Download datasheetforthisproducton http://www.atmel.com/dyn/resources/prod_documents/7766S.pdf. Visitthisproducttogetthefurtherinformationon http://arduino.cc/en/Main/ArduinoBoardLeonardo. 1.1.3ArduinoMega2560 TheArduinoMega2560isamicrocontrollerboardbasedontheATmega2560.Youcan downloadthedatasheetfileon http://www.atmel.com/dyn/resources/prod_documents/doc2549.PDF. FurtherinformationaboutArduinoMega2560,youcanvisiton 
http://arduino.cc/en/Main/ArduinoBoardMega2560. 1.1.4ArduinoDue TheArduinoDueisamicrocontrollerboardbasedontheAtmelSAM3X8EARMCortex-M3CPU.Youcandownloadthedatasheet, http://www.atmel.com/Images/doc11057.pdf.
IfyouwanttoknowaboutArduinoDue,Irecommendtovisitthiswebsite, http://arduino.cc/en/Main/ArduinoBoardDue.
1.2ElectronicComponents Weneedelectroniccomponentstobuildourtesting,forinstance,Resistor,LED,sensor devicesandetc.Irecommendyoucanbuyelectroniccomponentkit. 1.2.1ArduinoStarterKit Storewebsite:http://arduino.cc/en/Main/ArduinoStarterKit 1.2.2Fritzing Storewebsite:http://shop.fritzing.org/. YoucanbuyFritzingStarterKitwithArduinoUNOorFritzingStarterKitwithArduino Mega. 
1.2.3Cooking-Hacks:ArduinoStarterKit Storewebsite:http://www.cooking-hacks.com/index.php/shop/arduino/starter kits/arduino-starter-kit.html 
1.2.4ArduinoSidekickBasickit Storewebsite:http://www.seeedstudio.com/depot/arduino-sidekick-basic-kit-p-775.html Alternativeonlinestore http://www.amazon.com/Arduino-Sidekick-Basic-Kit-Version/dp/B007B14HM8/ http://www.exp-tech.de/Zubehoer/Arduino-Sidekick-Basic-Kit.html
1.3Go TheofficialwebofGocouldbefoundonhttps://golang.org/. WhatisGo?Basedon informationfromwebsite,wecouldknowwhatitis.Goisanopensourceprogramming languagethatmakesiteasytobuildsimple,reliable,andefficientsoftware.
InstallationofGoapplicationiseasy.ForWindowsandMacPlatform,youdownload setupfilefromGowebsite, http://golang.org/doc/install. Runitandfollowinstallation commands. ThenextstepistoconfigureGOROOTpath.ForWindowsplatform,youcanadd GOROOTvariableonEnvironmentVariables.ForMac/Linux,youcanitonyourbash profile.
ForWindowsplatform,youcanaddGOinstallationpath,forinstancemyGoinstallation pathisc:/go/bin,intoPATHvariableonEnvironmentVariables.
Afterconfigured,youcanverifyGoversionbytypingthiscommandonyourTerminalor CMDforWindows. 

TheoutputofprogramonWindowsplatform. 

TheoutputofprogramonWindowsplatform.
Inthisbook,IdontexploreallprogramminglanguageforGo.Youcanreaditonseveral bookorwebsite.IhavealreadywrittenabookaboutGoProgrammingbyExample.You cangetthisbookonthislink,http://blog.aguskurniawan.net/post/Go-Programming-by Example.aspx.
1.4ArduinoSoftware TodevelopapplicationbasedonArduinoboard,weneedArduinosoftware.Youcan obtainitonhttp://arduino.cc/en/Main/Software.Pleaseinstallbasedonyourplatform. IfyourplatformisUbuntu,youcaninstallbywritingthisscript sudoapt-getinstallarduino ForWindowsplatform,youcandownloadsetupfileandinstallit. ThefollowingisascreenshotofArduinosoftwareonUbuntuplatform. HereisArduinosoftwareonWindows8platform. 

1.5Testing Fortesting,IusedArduinoUnoR3andArduinoMega2560onUbuntuandWindows8.1 platforms. 

Next page