ARDUINO CLASS
(/tag/typeid/categorycraft/channelknittingandcrocheting/) Yarn(/tag/typeid/categorycraft/channelknittingandcrocheting/)
withbekathwia(/member/bekathwia/)
(/gifts/) Gifts(/gifts/)
FREE
Enrolled
24401Enrolled
BeginnerLevel
Enrolltoget:
7lessonsaccessibleanytime,anywhere
Learnbydoingwithhoursofprojectfocusedinstruction
Completemateriallistsanddownloadableprojectresources
OneonOnehelpwithyourquestions
ThisclasswillintroduceyoutotheArduinoworld.You'lllearnthebasics,buildyourfirstproject,andsomuchmore.Eachlesson
buildsonyourskills,infusingnewknowledgeandtechniquesalongtheway.
ThisclasswilllaunchyourArduinojourneyandgiveyoutheskillsandconfidencetotakeonalmostanyArduinoprojectyoumay
findorcreateinthefuture.
Withtheskillsyoulearninthisclass,youcanentertheArduinoContest(http://www.instructables.com/contest/arduino2016/)!
AbouttheTeacher
BeckyStern(http://www.instructables.com/member/bekathwia/)hasauthoredhundredsoftutorialsineverythingfromwearableelectronicstoknitting.
BeforejoiningInstructablesasacontentcreator,BeckyworkedasaseniorvideoproducerforMAKEMagazineandthenasthedirectorofwearable
electronicsatAdafruitIndustries.ShelivesinNewYorkCityandenjoysridinghermotorcycle,makingYouTubevideos
(https://www.youtube.com/c/beckystern),andcollectingnewhobbies.HerworkhasbeenfeaturedbyVICE,theBBC,TheLateShowwithStephenColbert,
Engadget,CNN,BusinessInsider,Forbes,andScienceFriday.
Lessons
0%
Complete
(/lesson/WelcometoArduino/)
WelcometoArduino E
(/lesson/ToolsandMaterialsforArduino/)
ToolsandMaterialsforArduino E
(/lesson/YourFirstExperiments/)
YourFirstExperiments E
(/lesson/InputOutput/)
Input/Output E
(/lesson/SkillsInfusion/)
SkillsInfusion E
(/lesson/ProjectInfinityMirror/)
Project:InfinityMirror E
(/lesson/ConclusionGoingFurther/)
Conclusion&GoingFurther E
F
MoreQuestions
What'sNext?
Finishedtheclass?Herearesomegreatprojectstopracticeyournewskills.
TermsofService(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21959721) |
PrivacyStatement(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21292079) |
LegalNotices&Trademarks(http://usa.autodesk.com/legalnoticestrademarks/) | MobileSite(http://www.instructables.com)
(http://usa.autodesk.com/adsk/servlet/pc/index?id=20781545&siteID=123112)
2016Autodesk,Inc.
11/12/2016 WelcometoArduino
WelcometoArduino
instructables.com/lesson/WelcometoArduino/
InvalidDate
sharewhatyoumake
Lesson1:WelcometoArduino
AskaQuestion
0%complete
Haveyoueverwantedtotinkerwithtechnology?Arduinoexiststohelpcreativepeopleandtechnobeginnersbuild
projectswithelectronics.Asaplatform,itfasttracksuserstosuccessbyhelpingeasethesetupburdenand
learningcurveusuallyassociatedwithelectricalengineeringandcomputerscience.
Arduinoisthebestwaytogetstartedwithmicrocontrollerprogrammingandbuildingyourowncircuitsthatsense
andreacttotheworldaroundthem.Inthisclass,we'llgetcreativewithelectronicsandgetcomfortablewiththe
http://www.instructables.com/lesson/WelcometoArduino/ 1/14
11/12/2016 WelcometoArduino
conceptsyou'llusetolaunchyourlongandfruitfulArduinojourney.
ThenameArduinodefinesseverallayersofyourexperience:
softwareusedtocomposeyourprogramsandcommunicatewiththehardware,calledanintegrated
developmentenvironment(ArduinoIDE)
hardwarereferstotheboardsthemselves(e.g.ArduinoUno)
programminglanguagetheArduinoprogramminglanguageisbasedonC
trademarkOtherbrandsmaymanufactureArduinocompatiblehardware,butonlysomeboardsareofficial,
andowningtheirtrademarkprovidessomeuniqueprotections.Forinstance,itallowsthehardwareand
softwaretoremainopensource.
Arduinoisalsoahugeglobalcommunity,whichmeansyou'llfindvastquantitiesofinspirationalprojects,sample
code,andsolutionstoyourproblemsonline.
WhatYou'llLearn
ThefollowinglessonsaredesignedtobuildyourskillsinArduinoincrementallyovertime,leavingyouwithenough
basicknowledgetogooutandcreateprojectsfromyourimagination.
http://www.instructables.com/lesson/WelcometoArduino/ 2/14
11/12/2016 WelcometoArduino
Earlyon,you'lldobreadboardexperimentstoincreaseyourfamiliaritywithkeyconceptsofelectricity,components,
andcodingintheArduinolanguage.
http://www.instructables.com/lesson/WelcometoArduino/ 3/14
11/12/2016 WelcometoArduino
Addinginteractivitywillbeyournextchallenge.Whileyoulevelupyourhardwareskillstoaddbuttonsandknobsto
controlyourcircuits,you'llalsolearnmoreprogrammingconcepts.
http://www.instructables.com/lesson/WelcometoArduino/ 4/14
11/12/2016 WelcometoArduino
Thenyou'llacquireavarietyofskillsforbuildingandprogramming,includingsoldering,understandingthepower
requirementsofyourArduinoprojects,installingcodelibraries,andcontrollingastripofaddressableLEDs.
http://www.instructables.com/lesson/WelcometoArduino/ 5/14
11/12/2016 WelcometoArduino
Finallyyou'llbuildacompleteproject:theInfinityMirror.You'llworkthroughallthestepsofdevelopingthisfunand
easyproject,andyoumayevenbeinclinedtocustomizethedesign!
TheconclusionisfilledwithtipsaboutcontinuingyourArduinojourneyafterthisclass.Learnhowtofindcodeand
circuitexamplesonline,findthevalueinsharingwiththecommunity,andincreasethedurabilityofyourcircuits.You
willgraduatewiththeconfidencetotakeoninfiniteArduinoprojectsinthefuture!
MeetYourInstructor
http://www.instructables.com/lesson/WelcometoArduino/ 6/14
11/12/2016 WelcometoArduino
Hi,I'mBeckyStern!IfirstusedArduinoincollegein2006atParsonsSchoolofDesign.Ifounditsomucheasierto
usethanthePICchipsandBASICstampsthatIhadbeenusingtoaddinteractivitytomyartsanddesignprojects
before.Ihavealwaysbeenverycrafty(haveyouseenmyknittingorbraidsclasses?),andsoIbeganintegrating
Arduinointomysewingandtoydesignprojects.In2007IpublishedatutorialforArduinodrivenplushirradiated
sirloinsteaksinMAKEMagazine,Volume11.AftergraduatingwithaBFAinDesign&Technology,Ipursued
graduatestudiesatArizonaStateUniversityinsculptureandtransdisciplinarydesign.Idroppedoutofgradschool
toworkatMAKEMagazinefulltime,whereIproduceddozensoftutorialsandvideos,includingalivewebshow.
From2012toearlierin2016IworkedasAdafruit'sdirectorofwearableelectronics,similarlypublishinginstructional
contentandhostingalivewebshow.NowI'montheInstructablesDesignStudioteam,writingthisclassandstill
publishinghowtocontentontheregular.Inadditiontopublishingtutorialsonallkindsoftopics,Ienjoyplayingwith
http://www.instructables.com/lesson/WelcometoArduino/ 7/14
11/12/2016 WelcometoArduino
mydog,makingYouTubevideos,vintagemotorcycles,andhangingoutatmylocalhackerspace,NYCResistor.I
alsoteachaclasscalledMakingStudiointheMFAProductsofDesignprogramatNYC'sSchoolofVisualArts.
PhotobyAndrewBakerforAdafruit
ArduinoHistory
TheoriginstoryofArduinoislongandcomplicated,withmorecharactersthanGameofThrones.I'llattemptto
summarizeithere,withafocusontheevolutionofthehardwareandcommunity.
Intheearly2000s,studentsandprofessorsattheInteractionDesignInstituteIvrea(IDII)inItalydevelopedanew
microcontrollerboardforusespecificallybyartistsanddesigners.Theyheldworkshopsandseminarsusingthe
boardsthroughoutdifferentiterations,whichwereprogrammedusingWiring,acreativecodingplatformdeveloped
byHernandoBarragn.Wiringeasilyallowedcreatorstoprogrammicrocontrollersbyprovidingasupportive
softwareenvironment,abootloaderforeasilyuploadingprogramstotheboard,andacomprehensiveonline
referenceincludingaddonlibrariesandforums.
SomeothermembersofIDIIpartneredwithamanufacturertodevelopaversionofthehardwarethatusedan
Atmega8microcontroller,andArduinowasborn.TheoriginalArduinoteammembers'namescanbefoundonthe
ArduinoNGboardpicturedabove:MassimoBanzi,DavidCuartielles,TomIgoe,GianlucaMartino,andDavidMellis.
http://www.instructables.com/lesson/WelcometoArduino/ 8/14
11/12/2016 WelcometoArduino
TheArduinoUnowe'lluseinthisclassistheflagshipdevelopmentboardoftheArduinobrand,anditisthelatest
iterationinalonglineofboardswithamissiontomakeiteasierfornonengineerstouse.
Featuresaccruedovertime,andDIYupgradetutorials
alsowerepublished,whenapplicable.Irecallhand
solderingacapacitortotwopadsonmyArduinoNGin
ordertotakeadvantageofanewDiecimila'supdate.
Thepinlayoutwasconsistentbetweenboards(with
somemorepinsaddedinlatermodels)sothataddon
shieldscouldbebackwardscompatible.There'safull
chronologyabouttheboardthatbecametheUnoon
theArduinosite.
http://www.instructables.com/lesson/WelcometoArduino/ 9/14
11/12/2016 WelcometoArduino
OtherboardswithspecializedfunctionshavebeenreleasedintheArduinoproductline.Needmoreinputsand
outputs?UseanArduinoMega.WantasmallercircuitboardandUSBkeyboardfunctionality?UseanArduino
Micro.Andsoforth.OfficialArduinoboardsareallnativelysupportedbytheArduinosoftware.
Fortheenthusiast,it'spossibletodevelopyourownhardwarethatworkswiththeArduinosoftware,too.Because
Arduinoisanecosystemofopensourcehardwareandsoftware,it'spossibletodevelopyourownhardwarethat
workswiththeArduinosoftware.Itisalsopossibletobuildonthecircuittocreateaversiontosuitamorespecific
function,andmanufactureandsellthosedesigns.Becausetheplanshavebeenfreelyavailableonline,you'llsee
hundredsofArduinocompatibleboardsdesignedbycorporationsandindividualsalike,rangingwildlyinfunction
andcomplexity.SomearedesignedtobepincompatiblewiththeArduinoUno,liketheSparkfunRedboardor
AdafruitMetro.MorecompactboardsforbuildingtidysmallcircuitsliketheProTrinketandProMinimakeiteasyto
translateyourbreadboardprototypetoafinishedproject.ComplexboardsliketheHuzzah(wifi),TouchBoard
(capacitivetouch+audioplayback),andCircuitPlayground(beginnerlessonsbakedintotheboard)empower
beginnerstoaccomplishverysophisticatedprojectswithease.
Next
AskaQuestion
Giveyourquestionasdescriptiveatitleaspossiblesootherscaneasilyfindit.Max70characters.
?
http://www.instructables.com/lesson/WelcometoArduino/ 10/14
11/12/2016 WelcometoArduino
QuestionBody:giveusmoredetailonyourquestion...
AddPhotosAskaQuestion
StranglySwitchingONsigns....!!!?Answered 1Answer
AskedbyAsket11
Answer
OnswitchingONforthe1sttimeArduinoUNOR3onUSBandevenonDC9vsupply,GreenLEDisON,the
OrangeLEDisBlinking.TriedtoresetandloadloadIEDbutfailed.....!!PhotoofPCBinQuestionisenclosed
ReplybybekathwiaBestAnswer
Reply
Thebehavioryoudescribeisthedefault!Whentheboardhaspoweritwillrunits
sampleprogramwhichblinkstheorangeLED.Ifyouarehavingtroubleuploading
newprograms,doublecheckyoursoftwareconfigurations(boardtypeandport).
Thispageisagreatresourcefortroubleshooting:
https://www.arduino.cc/en/Guide/Troubleshooting
locationtrackking?
lawnmowerthatlearnshowtomowafterimowlawn?Answered 1Answer
Askedbyloveagoat
Answer
I'dliketocreatealawnmowerthatwouldimitatemymotionandmowthesamelawnlaterusingmystored
positionswhereihadwalked.Isthispossible?
canweusearduinothroughcodes?Answered 1Answer
AskedbyBhuvanaj
http://www.instructables.com/lesson/WelcometoArduino/ 11/14
11/12/2016 WelcometoArduino
Answer
itslikeiminventingalawnmowersoiwantimplementanarduinoboardtothewheelsandthroughaandroid
mobilephonecanweoperatethemovementofthosewheelswithcodingnwireless
writemyowncode?Answered 1Answer
AskedbyAlok31
Answer
Caniwritemyowncodeafterthislessonandmakemyowncircuits??
HelloMaam...howtomakeasmallhumanoid?Answered 1Answer
AskedbyXeroxRoboHuman119
Answer
HelloMaam....I'maclass9studentandIhaveaexhibitioncomingupinbetweenlasttwoweeksof
December....IneedyourhelpinusingArduinoandaBluetoothHCconnectorandconnectingmymobileas
controller.....maamIwouldliketoaskwhichtypeofmotorstouseandhowtoconnecttoArduinoandwhat
allarethematerialsrequired
arduinoclone?Answered 1Answer
Askedbyraynoki
Answer
hiwhataboutarduinocloneisitsuitableforthiscourseimesanfunduino?
ReplybybekathwiaBestAnswer
Reply
YouarerecommendedtouseanofficialArduinoUnoforthisclass,butmanycompatibleswillworkjust
fine(therearetoomanytoprovideafulllistofcompatibleboards).
Createaweatherstation? 1Answer
http://www.instructables.com/lesson/WelcometoArduino/ 12/14
11/12/2016 WelcometoArduino
Askedbyeleazarc1
Answer
Hi,BekathwiaIamEleazarandIamfromPeruandIneedyourhelptocreateaweatherstationwhatsend
realtimeinformationdata.
?Answered 1Answer
Askedbywoooshhhhh
Answer
CanArduinorunonaChromebook?Iknowyoudidntsayitintheexamples,butisawavideowithaguy
usingitonachromebook.
Hardware?Answered 1Answer
Askedbywjc1000
Answer
HelloIsthereahardwarebundlethaticanbuyforthiscourse,ifso,canyouprovidealink?
ReplybybekathwiaBestAnswer
Reply
Yep,everythingyouneedislistedintheToolsandMaterialsforArduinolesson.
MoreQuestions
DoubleClick
FacebookConnect
GoogleAnalytics
GoogleTagManager
http://www.instructables.com/lesson/WelcometoArduino/ 13/14
11/12/2016 WelcometoArduino
Mixpanel
Quantcast
ScoreCardResearchBeacon
Smaato
http://www.instructables.com/lesson/WelcometoArduino/ 14/14
11/12/2016 ToolsandMaterialsforArduino
ToolsandMaterialsforArduino
instructables.com/lesson/ToolsandMaterialsforArduino/
InvalidDate
sharewhatyoumake
Thislessonisacompletelistofthesuppliesyou'llneedtocompletethisclass.Tomakeitabiteasiertoget
everythingatonce,I'vecreatedanAdafruitwishlistcontainingmostofthecomponentsandtools.Togetstartedwith
thebareminimum,youcancompletemostofthecoreexerciseswiththecontentsoftheAdafruitArduinoUno
BudgetPack.Ifyou'reusingadifferentkit,someofthecomponentsmaydifferfromthoseshowninthephotos
throughoutthisclass.
Forthebasicexercises:
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 1/15
11/12/2016 ToolsandMaterialsforArduino
TocompletetheSkillsInfusionlesson(here'sagreattoolkitwithalmosteverythingyouneed):
Additionalcraftsuppliesforthefinalproject:
Sharputilityknife
MetalrulerorTsquare
Cuttingmatorscrapcardboard
Printerfortemplateorcircledrawingcompass
Plasticscoringknife(optionalbutnice)
Hotmeltgluegun,orE6000/QuickHoldcraftadhesive
Clothespin(optional,touseasaglueclamp)
4"roundmirror
Seethroughmirrorplastic
Blackfoamboard,3/16"thickness
Tobuildthefinalprojectwithdedicatedcomponents:
RecommendedvendorsforArduinocomponents&accessories:
UnderstandingtheTools
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 2/15
11/12/2016 ToolsandMaterialsforArduino
ArduinoUnoThisboardisbuiltaroundtheAtmega328microcontroller,withsupportingcomponentstomakeit
easytoconnectupyourowncircuits.TheUnoconnectstoyourcomputerwithaUSBAtoBcable,whichis
commonlyusedforprinters(boxyconnector).Forthisclass,itisacceptabletouseacompatiblestandinforthe
ArduinoUno,suchasaSparkfunRedBoardorSeeeduinoV4.2,justmakesureyouhavetherightUSBcable.
SolderlessbreadboardThisdevicehasstripsofmetalinsideandmanyholesthatallowyoutoconnect
componentsquicklyandeasily.Amountingplateisrecommended,tokeepthebreadboardandArduinoUno
together.You'llconnecttotheArduinowithwires(breadboardwiresaregreatbutyoucanalsousesolidcore
hookupwire).
ElectroniccomponentsYou'llcreatecircuitsbypluggingLEDsandothercomponentsintoyourbreadboard.This
classintroduceseachnewcomponentwithabasicexerciseshowingyouhowtowireitupandwriteanappropriate
Arduinoprogram.Componentsused:5mmLEDs,resistors,apushbuttonswitch,apotentiometer,andasmallDC
motor(withitsowndiodeandtransistor).Lessonscoverthebasicswithanemphasisonwritingcodetointeractwith
thecomponents.Formoreindepthinformationbeyondwhat'scoveredhere,pleasecheckoutRandySarafan's
ElectronicsclassorLEDs&Lightingclass.
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 3/15
11/12/2016 ToolsandMaterialsforArduino
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 4/15
11/12/2016 ToolsandMaterialsforArduino
SolderingtoolsTheSkillsInfusionlessonteachesyouhowtoconnectwirestoLEDstripwithasolderingiron,
whichheatsthecomponentsenoughtoflowsolder(aneasymeltingalloy)betweenthem.Anybasicironwilldo!
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 5/15
11/12/2016 ToolsandMaterialsforArduino
Wirestrippersremoveinsulationtoexposetheconductorinside,pliersandtweezershelpyoupositioncomponents,
andathirdhandtoolhelpskeepeverythingsteady.Flushsnipsdoagreatjobtrimmingexcesswiresand
componentleadsaftersoldering.Wearprotectiveeyewearwhensolderingandclippingwires,andsolderinawell
ventilatedarea.
RGBWNeoPixelstripThisdigitallyaddressablestripcontainsWS2812chipscontrollingcompoundLEDsinred,
green,blue,andwhite.NeoPixelistheAdafruitbrandnamebutyoucanalsofindthisstripbysearchingfor
"WS2812bRGBWstrip"onyourfavoritesupplier'ssite.Thesamplecodeprovidedinthisclasswillnotworkwith
RGB(nowhite)strip,analogLEDstrip,orwithanyotherkindofdigitalcontrolchip(likeAPA104akaDotStar).
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 6/15
11/12/2016 ToolsandMaterialsforArduino
CraftsuppliesThefinalprojectwalksyouthroughbuildinganelectronicsenclosurefromfoamcoreboard,which
requiresaprotectedworksurface(cuttingmatormultiplelayersofscrapcardboard),metalruler,andsharputility
knife.Youcaneitheruseahotglueguntoassemblethepieces,oroptforacraftadhesivelikeE6000.Around
glassmirrorisatthecenteroftheinfinitymirror,andapieceofseethroughmirrorplasticisthesecretingredientfor
theinfinitytunneleffect.Ifyoudon'thaveaplasticscoringknife,youcanuseapairofsturdyscissorstocutthe
mirrorplastic,butleaveawidermarginthanyouthinkyou'llneed,sincethemirrorfilmtendstoflakealittlearound
scissorcutedges.Becarefulwhenusingsharptools,keepabowloficewaternearbyanyhotglueprojectforquick
burntreatment,anduseproperventilationforanyadhesives.
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 7/15
11/12/2016 ToolsandMaterialsforArduino
ArduinoGemmaTheinfinitymirrorprojectminiaturizestheArduinocircuitbysubstitutingtheArduinoUnowithan
ArduinoGemma.GemmaisatinyboardbuiltaroundtheATTiny85microcontroller,whichhaslessmemoryand
fewerfeaturesthantheUno'sAtmega328,butit'salsosmallerandlowercost.Thelargepadsaresupereasyto
solderto(andsewtowithconductivethread,butthat'satopicforadifferentclass).GemmausesamicroUSB
cabletoconnecttoyourcomputer,andhasaJSTportforconnectingabattery.You'lllearnhowtoprogramGemma
fromtheArduinosoftwareandbuilditintothefinalproject.YoucanalsouseanAdafruitGemmainstead,butyou
willneedtoperformanadditionalsteptoconfiguretheArduinosoftware.
SoftwareSetup
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 8/15
11/12/2016 ToolsandMaterialsforArduino
TheArduinoIDE(softwareforcomposingcodeandsendingittoyourboard)runsonWindows,MacOSX,and
Linux.Headtothedownloadpageandclicktheoptionthatbestdescribesyoursystem.Whilethesoftwareis
downloading,connectyourArduinoboardtoyourcomputerwithaUSBAtoBcable(flattoboxy,typicallyusedfor
printers).ThegreenLEDnexttothelabelONshouldturnon,andtheorangeLEDnexttothelabelLshouldbegin
blinking.
Dependingonyouroperatingsystem,yoursoftwareinstallationprocedurewillvary.OnWindows,runtheinstaller,
whichwillalsoinstallthenecessarydrivers(providedyourArduinoboardispluggedin).OnOSX,dragtheArduino
appintoyourApplicationsfolder(nodriversnecessary).FormorehelpwithWindowsiftheinstallationdoesn'tgo
smoothly,refertoArduino'sdetailedinstructions.Ifyouprefernottodownloadsoftware,mostoftheclasscanalso
becompletedusingtheArduinoWebEditor.
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 9/15
11/12/2016 ToolsandMaterialsforArduino
OpentheArduinoapplicationandloadupthefirstcodeexamplebyselectingFile>Examples>01.Basics>Blink.
Nextit'stimetotellthesoftwarewhatkindofArduinoboardweintendtoprogram.SelectTools>Board>
Arduino/GenuinoUno.
ThenweneedtoselectthecommunicationportconnectedtotheArduinoboard.SelectTools>Port,then
whicheverportnameislabeled"(Arduino/GenuinoUno)."Ifnoneofyourportsarelabeled,tryunpluggingyour
board,checkingthePortsmenu,thenrepluggingyourboardandcheckingthePortsmenuagain.Whicheverport
namedisappearsthenreappearsislikelytobeyourArduinoboard.OnWindowsyourportwilllikelybecalled
"COM3"(orhighernumbers)andonOSXit'slikelytobesomethinglike"/dev/cu.usbmodem1461."
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 10/15
11/12/2016 ToolsandMaterialsforArduino
NowclicktheUploadbuttontotransfertheBlinkexamplecodetotheArduinoboard.TheLEDslabeledRXandTX
willflash,andthesoftwarewillshowamessage"Doneuploading."MomentslatertheLEDlabeledLwillbegin
blinkingasitdidwhenyoufirstpluggeditin.
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 11/15
11/12/2016 ToolsandMaterialsforArduino
Congratulations,you'rereadytobeginthenextlesson,wherewe'lldigintothecodeyoujustuploaded,aswellas
buildyourfirstfewLEDcircuitsanddiscoverhowtocontrolthemusingbasicArduinoprogrammingconcepts.
Ifyourportdoesn'tappear,oryougetanerrorwhentryingtoupload,refertoArduino'sdetailedtroubleshooting
guide,whichcoversmanyothercommonissues.
PreviousNext
AskaQuestion
Giveyourquestionasdescriptiveatitleaspossiblesootherscaneasilyfindit.Max70characters.
QuestionBody:giveusmoredetailonyourquestion...
AddPhotosAskaQuestion
WS2812bstripsubstitute?Answered 1Answer
AskedbyJas_and_Ian
Answer
HiTheWS2812bstripisnolongeravailablefromadafruit.Whenisearchaliexpressetcforthisstriptheyall
seemtorecommendaSK6812stripstatingitissimilar.Willthisworkforthisproject.
Thanksisadvance
completslistofcomponents?Answered 1Answer
AskedbyF1rstb81
Answer
couldyoupleasegetafulllistofeverythingneededitkindajumpsaroundandsaysalotofthingsare
optionalIwouldliketoknowspecificallywhatIwillneedtoordertosuccessfullycompletethisclasswithout
anyproblemsthanks
ReplybybekathwiaBestAnswer
Reply
Thelistatthestartofthislessoniscompleteandveryspecificyouneedeverythingonitexceptfor
fouroptionalitems.Ifyou'reunsureaboutanoptionalitem,readthroughtheclassanddecidewhether
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 12/15
11/12/2016 ToolsandMaterialsforArduino
youneedit,orjustgetittobeonthesafeside.
IntroductiontoElectronics?Answered 1Answer
AskedbyPeterGrund
Answer
Hello!
Iamabeginnerinelectronics,withlittleknowledge.Isthisagoodplacetostart?
Howarduinoshowsoutputonserialmonitor?Answered 1Answer
AskedbyRajkumar2506
Answer
BecauseinordertodisplayoutputofanymicrocontrollerinComputerwehavetoUseMAX232interface.
ButthereisnoMAX232usedinarduinoboard.Thenhowitisdisplayingoutputinserialmonitor
1N4007diode?Answered 1Answer
AskedbySamuelO59
Answer
Hi,thekitIwanttobuyhaseverythingIneedexceptforthe1N4001diode.Ithasa1N4007diodeinstead,
willthisdothejob?
WillthisLEDlightstripkitwork?Answered 1Answer
OnlineSupplierinCanada? 1Answer
AskedbyTaolin
Answer
Heythere,
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 13/15
11/12/2016 ToolsandMaterialsforArduino
I'mlookingforagoodonlinesourceforthematerialsneededinthisclassthatoperatesoutofCanadato
avoiddutycharges.Doesanyoneknowofanyoptions?
ReplybyTaolin
Reply
Feelfreetoignoremyquestion.Iseethatyouaddedsomelinksatthebottomofyourshoppinglist.
Thanks!
S/Wversion?Answered 1Answer
Askedbyjmhasson126
Answer
IboughtanauthenticArduinostarterkitandfoundalabelonthecellophanewrappertogoarduino.orgto
downloadthes/w.Itturnsoutthatversion1.7.11wasthelatestversion.Afterdownloadingthisversion,I
couldn'tuploadtheblinksketch.Ithendeletedthatversionandwenttoarduino.ccanddownloadedversion
1.6.12andwasabletouploadtheblinksketch.Myquestiontoyouishowdoyouknowwhichversionshould
beusedorwhichsitehastherightinformation?
ReplybybekathwiaBestAnswer
Reply
TheArduinogroupwentthroughabitofalegalbattlerecently,anditsplitapartthecompanyfora
while,whereusersoutsidetheUSweredirectedtoArduino.org.Howeverthedisputehasbeensolved
andthebandisbacktogether,howeverthewebsiteshaven'tbeenconsolidatedtoreflectthatyet.I
realizethat'sconfusing,butifyou'reuploadingsuccessfullywith1.6.12thatyoudownloadedfrom
Arduino.cc,you'reallgoodforthisclass.=DMoreinfo:
http://arstechnica.com/business/2016/10/arduinoon...
https://blog.arduino.cc/2016/10/01/twoarduinosbe...
http://makezine.com/2015/03/19/massimobanzifight...
Howcantheseholdthememory?Answered 1Answer
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 14/15
11/12/2016 ToolsandMaterialsforArduino
ReplybybekathwiaBestAnswer
Reply
Here'sahelpfulvideoabouthowcomputermemoryworks:
Whatisthecosttogetstarted?Answered 1Answer
Askedbyjoan.henley.96
Answer
Whatisthetotalcosttotakethiscostinsuppliestofunctionproperly?
ReplybybekathwiaBestAnswer
Reply
Allin,therequiredelectronicssuppliesforthisclasscostabout$200(checkouttheAdafruitlinkinthe
firstparagraph),thenthere'sancouplebucksincraftsuppliesforthefinalproject,dependingonwhat
youalreadyhaveonhand.
MoreQuestions
DoubleClick
FacebookConnect
FacebookSocialGraph
GoogleAnalytics
GoogleTagManager
Mixpanel
Quantcast
ScoreCardResearchBeacon
http://www.instructables.com/lesson/ToolsandMaterialsforArduino/ 15/15
11/12/2016 YourFirstExperiments
YourFirstExperiments
instructables.com/lesson/YourFirstExperiments/
InvalidDate
sharewhatyoumake
YourFirstExperiments
withbekathwia
Rollupyoursleevesandlet'sdigin!Inthislesson,we'llconductsomebasicbreadboardexperimentstointroduce
youtothebasicArduinoconceptsandworkflow.
First,setyourselfupforsuccessbyaffixingyourArduinoUnoboardandsolderlessbreadboardtoamountingplate.
Trustmeonthisoneitprovidesahugebenefitofholdingyourprototypestogetherandkeepingthemoutof
trouble!Thesolderlessbreadboardhasastickerbackyoucanpeeloff(peeloffthemountingplate'spaperbacking
aswell),andtheArduinoUnoattacheswithscrewsfromtheunderside.Itdoesn'tmatterwhichwayyourArduinois
facinginrelationtothebreadboard.Asmallscrewdriverishandyhere,soyoucanholdanylonnutinplaceonthe
http://www.instructables.com/lesson/YourFirstExperiments/ 1/29
11/12/2016 YourFirstExperiments
topoftheboardanddrivethescrewfromthebottom.
Onlytwodiagonallyplacedscrew/nutcombosare
requiredforasecurefit.Rubberfeet(includedwith
plate)helpthewholeassemblystablewhileyouwork
andnowyourcircuitisalsomoreportableand
protectedfromanywirebitsthatmightbestrewn
aroundyourworksurface.
Supplies
Tofollowalongwiththislessonyouwillneed:
SolderlessBreadboards
http://www.instructables.com/lesson/YourFirstExperiments/ 2/29
11/12/2016 YourFirstExperiments
Solderlessbreadboardsareforprototypingcircuitsquicklyandeasily.Youcanthinkofitasakintoadryerase
board,greatforspeedybrainstormingandexperimentation.Breadboardsallowyoutoconnectcomponentsusing
multiportmetalsockets.Theconductivepartsofthebreadboardallowelectronstoflowbetweenthethingsyou
plugintoit.
http://www.instructables.com/lesson/YourFirstExperiments/ 3/29
11/12/2016 YourFirstExperiments
Ontherightyoucanseeinsideabreadboardtoobservehowthesesocketsareconnected.Twolongrailsrundown
eachside,markedwithredandbluelinesonthefront.Theselongconnectorsaretypicallyusedforpowerand
groundconnections,whichareusedquiteoften.Thesmallhorizontalrowsthatcomprisethemiddleoftheboard
areforplugginginwiresandcomponents.Noticethedividerdownthemiddleoftheboardthisexiststoprovide
chipsaplacetostraddle,providingindependentaccesstoeachofitspins.
Ittakessomepracticetogetthehangofusingasolderlessbreadboard,mainlybecauseit'shardtoremember
whichspotsareconnectedtowhichotherspots.Youmayfindyourselfreferringbacktothephotooftheinsideof
thebreadboardfrequentlythat'sperfectlynormal!
BlinkCircuit
http://www.instructables.com/lesson/YourFirstExperiments/ 4/29
11/12/2016 YourFirstExperiments
Thefirstcircuitwe'llbuildonthesolderlessbreadboardconnectsaredLEDtotheArduinoUnoboard.Let'sstart
outslowly,withonewireconnectionatatime.Followalongwiththesamecoloredwirestomakeiteasieronus
both.DoublecheckthatyourUSBcableisdisconnectedbeforedoinganywiringtoyourboard.Grabaredwireand
plugoneendintothepinmarked5VontheArduinoboard.Plugtheotherendoftheredwireintothebreadboard
railmarkedwitharedlinethiswillbeyourpowerbus.
http://www.instructables.com/lesson/YourFirstExperiments/ 5/29
11/12/2016 YourFirstExperiments
Similarly,grababluewireandplugitintooneofthepinsmarkedGND,rightnexttotheredwire.Therearethree
groundpinsonanArduinoUno,andthey'reallwiredtothesamegroundasthechipandtherestoftheboard,soit
doesn'tmatterwhichoneyouchoose.Plugtheotherendofyourbluewiretothebluegroundbusonyour
breadboard.Thisisacommonconfigurationyouwilluseagainandagain,andshouldbeyourgotosetupfornew
breadboards,evenifyouaren'tusingbothbusesimmediately.Circuitsinthislessonwillconnecttothegroundbus,
andinthenextlessonyou'llusesomecomponentsthatwillconnecttothe5Vpowerbus.
http://www.instructables.com/lesson/YourFirstExperiments/ 6/29
11/12/2016 YourFirstExperiments
Next,plugayellowwireintoArduinopin13.Plugtheotherendintoanyhorizontalrowonyourbreadboard(row10
shownabove).Forthisfirstcircuit,allofyourconnectionsshouldbecomposedonthehalfofthebreadboard
closesttotheArduinoboard.
http://www.instructables.com/lesson/YourFirstExperiments/ 7/29
11/12/2016 YourFirstExperiments
Connectanotherbluewirefromanypinonyourgroundrailtoanotherhorizontalrowonyourbreadboard(row18
shownabove).
Nowgraba1Kresistor(stripesarebrownblackred
gold),andplugoneofitswireleads(doesn'tmatter
which)intothesamerowasthebluewire.Resistorsall
looksimilar,exceptforthestripesusedtoindicatetheir
value.
http://www.instructables.com/lesson/YourFirstExperiments/ 8/29
11/12/2016 YourFirstExperiments
Plugtheotherendintoarowrightnexttotheyellowwire.
http://www.instructables.com/lesson/YourFirstExperiments/ 9/29
11/12/2016 YourFirstExperiments
NowgrabaredLED(lightemittingdiode).Seehow
oneofitswireleadsislongerthantheother?That's
thepositivelead(anode),andtheshorterleadis
negative(cathode).Inthecircuitwe'rebuilding,
positivechargecomesfromtheArduinopinandgoes
throughtheLEDandresistortoground,soyoushould
connectthepositive(longer)leadtotheyellowwire
andthenegative(shorter)leadtotheresistor.A
resistorhelpslimitthecurrentgoingthroughanLED,
whichdoesn'tdoagreatjoboflimitingitself.
AnotherwaytoguessthepolarityofanLEDisby
lookinginsidethelensattheanvil(biggerpieceof
metal)andpost(smallerpieceofmetal).Theanvilis
usuallythecathode,butasyoucanseeintheabove
video,notallLEDsobservethesamepolarity
conventions.Theonlywaytobetotallycertainofits
polarityistotestit.TolearnmoreindepthaboutresistorsandLEDs,checkouttheLEDslessonintheInstructables
LEDs&LightingClass.
http://www.instructables.com/lesson/YourFirstExperiments/ 10/29
11/12/2016 YourFirstExperiments
PluginyourUSBcableandtheLEDshouldimmediatelystarttoblink!It'sprogrammedtoblinkwhatever's
connectedtopin13.ThatincludestheonboardLEDyousawinyoursoftwaresetupaswellastheoneyoujust
wiredup.
IfyourLEDisn'tblinking,unplugyourUSBcable,thenreverseyourLEDandreplugyourUSBmaybetheLEDwas
justpluggedinbackwards(whichwon'tdamageit,butwon'tlightitup,either).Orperhapsoneofyourotherwires
orresistoraren'tconnectedcorrectly.Doublecheckyourconnectionsagainstthediagramofthecircuit:
Click"StartSimulation"toruntheArduinoemulator,whichhasthe"blink"sampleprogramloadedup.We'lluse
AutodeskCircuitsmoduleslikethisonethroughouttheclasstohelpyoubuildalong.Theycontainwiringdiagrams
foryourbreadboardexperimentsaswellasthecodeyou'llneedforeach.Clickthe"CodeEditor"buttontoseethe
program,calledanArduinosketch.Itlookslikethis:
http://www.instructables.com/lesson/YourFirstExperiments/ 11/29
11/12/2016 YourFirstExperiments
You'llusetheArduinoIDEtomanipulateprogramslikethisoneandsendthemtoyourArduinoboardtorun.You've
alreadyloadedthissketchontoyourArduinoboardinthesoftwaresetupfromthepreviouslesson,butarefresher
can'thurt:youcanfindthissketchandmanyotherexamplesusedinthisclassthroughtheArduinosoftwaremenu
(File>Examples>Basics>Blink).
Examplesketchesmakegreatstartingpointsforexperimentationandyourownprojectsdowntheline.These
examplesareinvaluabletoyourArduinolearningexperienceusethem!It'scommontomakelotsoftyposwhen
writingyourfirstcode,whichcancauseconfusingerrors.Theexamplescomeinhandyiswhenyouwanttofixup
yourownnotworkingcode(calleddebugging).Comparingyourworktodefinitiveexamplesofworkingcodecan
beonehelpfulstrategytohelpdebugyourcode.
Let'stakeacloserlookattheelementsofthisbasicArduinosketch.Firstupisalittlenote:
//Pin13hasanLEDconnectedonmostArduinoboards.
//giveitaname:
Thisisjustacomment,meanttohelphumansunderstandtheprogram.InArduinoprograms,commentsare
signifiedwithtwoslashesanythingonasinglelineaftertheslashesisdiscardedwhenitcomestimetocompile
(buildthiscodeintothemachinereadableversionthatwillrunontheArduinoboard).Thereforecommentsdon't
contributetoyourprogram'ssize,socommentaway!Youmayeasilyforgetwhateachsectionofyourprogramis
supposedtoaccomplishIstronglyrecommendyoutogetintothehabitofheavilycommentingyourcode,and
readingthecommentsineachoftheexamplesweuseinthisclass.
intled=13;
Nextupisavariabledeclaration.Youcanthinkofavariableasabucketforsomeinformation.Variables,like
buckets,havesizesandshapestoholddifferentkindsofinformation.Variablesalsohavenames,likeamandatory
labelonthebucket.Thislineofcodedefinesavariableoftypeint,whichmeansinteger.Rememberbackto
primaryschoolmathclass,whenyoumighthavelearnedthatintegersarewholenumbers(positiveornegative).So
wehaveabucketthatcanholdaninteger.It'slabelisledbutcouldjustaseasilybe"MyLEDPin"oranysingleword
(lettersandnumbersonly,casesensitive)becausethispartofthevariabledeclarationisuptoyou.Istronglyadvise
usingdescriptivenamesforyourvariablessoyoucankeeptrackofwhatyourprogramisdoing!
Afterthelineofcodeabove,anytimewesee"led"intheprogramwillbeswappedoutforthenumber13.Thisis
handyforconfigurationslikeours,wherewewantawaytoreferencewhichpintheLEDisconnectedto,overand
over,butifthewiringchangeswe'llonlyhavetoupdateitononeplaceinthecode.
//thesetuproutinerunsoncewhenyoupressreset:
voidsetup(){
Asthecommentsuggests,anythingbetweenthislineandtheclosingcurlybrace}ispartofthesetup,asectionof
codethatrunsoncepersession.Codeinsidethesetupexecutesonetimewhenyourboardfirstpowersup,or
http://www.instructables.com/lesson/YourFirstExperiments/ 12/29
11/12/2016 YourFirstExperiments
whenyoupresstheArduino'sresetbutton.
//initializethedigitalpinasanoutput.
pinMode(led,OUTPUT);
}
Pins013onyourArduinoboardaredigitali/opins,whichmeanstheycanbeeitherinputsoroutputs.pinMode();
isafunction,ashorthandwaytorefertosubsetofcommands"underthehood,"sotospeak.Arduinoshowsyouit
recognizescertainelementsofcodebychangingitstextcolor.Ifeverakeywordisn'tchangingcolorasyoutypeit
inArduino,youprobablyhaveamisspelling,capitalizationerror,orothertypo.Thesepiecesofinformationpassed
tofunctionsarecalledarguments.Sincethevariableledwillserveupitscontentsanytimeyoutypeit,thepin
numberpassedtopinMode();is13,andthestateisOUTPUT.Thissetsuppin13tocontrolanLED,andthecurly
braceclosesthesetup.
//thelooproutinerunsoverandoveragainforever:
voidloop(){
ThisisthemainpartofanArduinosketch,whereactionslikecheckinginputpinsandcontrollingoutputpinsusually
happen.Everythingbetweenthislineanditsclosingcurlybrace}willoccuronrepeatuntiltheboardlosespower.
digitalWrite(led,HIGH);//turntheLEDon(HIGHisthevoltagelevel)
FirstupintheloopisafunctioncalleddigitalWrite();,whichtakestwopiecesofinformation:apinnumber,and
aHIGH(on)orLOW(off)state.Thesepiecesofinformationpassedtofunctionsarecalledarguments.Sincethe
variableledwillserveupitscontentsanytimeyoutypeit,thepinnumberpassedtodigitalWrite();is13,and
thestateisHIGH(on).ThislineofcodecausestheLEDinyourcircuittoturnon.
delay(1000);//waitforasecond
delay();isanotheroneofArduino'sbuiltinfunctions.Itpausestheprogramforanamountoftime,writtenin
milliseconds.Thislineofcodepausestheprogramfor1000ms,oronesecond.
digitalWrite(led,LOW);//turntheLEDoffbymakingthevoltageLOW
Asearlier,digitalWrite();canturnanoutputpinonoroff.Thistimeitsetspin13LOW(off).
delay(1000);//waitforasecond
}
Thislinepausestheprogramforonesecond,andthecurlybracesignifiestheendoftheloop,whichbeginsagain
immediately.Sotosummarize,theprogramturnsanLEDonandoffatonesecondintervals.Let'stryswitchingup
thatinterval.Modifythenumberofmillisecondsinoneorbothofyourdelay();statements.Forinstanceyoucould
createamoreunevenblink:
voidloop(){
digitalWrite(led,HIGH);//turntheLEDon(HIGHisthevoltagelevel)
delay(2000);//waitfortwoseconds
digitalWrite(led,LOW);//turntheLEDoffbymakingthevoltageLOW
delay(500);//waitforahalfsecond
}
TryuploadingyourmodifiedblinksketchtoyourArduinoboard.Diditbehaveasyouexpecteditwould?
Welldone!Thatwasalotofinformation.It'sokifyoudon'tquiteunderstandeverylittlethingyet.Likelearningany
language,theArduinoprogramminglanguagehasitsownsyntaxandstructureyoumustnavigate,whichwill
http://www.instructables.com/lesson/YourFirstExperiments/ 13/29
11/12/2016 YourFirstExperiments
becomemorefamiliarwithregularpractice.Themostimportantthingtorememberisthatyoucanworkwithcode
withoutknowingeverythingaboutprogramming.Asyougothroughtheexercisesinthisclass,Iencourageyouto
leaveawindowopenloadedwiththeArduinolanguagereferencepage,whichdescribeseachelementand
providessampleusage.
AddMoreLEDs
Nowthatyou'vegotthebasicideaofhowtocontrolasingleLED,let'saddsomemore!Grabtherestofyourred
LEDsand1Kresistors.UnplugyourArduinofromUSB/powerifitwasn'talready.It'ssmarttodisconnectpowerany
timeyouarechangingyourcircuit.
Connectthetwopairsofrailsonyoursolderlessbreadboard:plugawireconnectingbothpowerbuses(red,+)and
anotherwireconnectingbothgroundbuses(blue,).Thisisacommonlyusedconfiguration,sincenowyoucan
easilyaccesspowerandgroundonbothedgesofthebreadboard.Bendtheleadsofyourresistorsto90degrees
andtrimtheendstoaboutaquarterinch(6mm)fromthebend.
http://www.instructables.com/lesson/YourFirstExperiments/ 14/29
11/12/2016 YourFirstExperiments
http://www.instructables.com/lesson/YourFirstExperiments/ 15/29
11/12/2016 YourFirstExperiments
Youdon'ttechnicallyhavetobendandtrimyourresistors,buttheysuredotidyupyourbreadboard.Replacethe
resistoronyourbreadboardwithatidieroneandseewhatahugedifferenceitmakesinthelegibilityofyourcircuit.
Andyou'relesslikelytocreateanaccidentalshortcircuitthisway,too.
http://www.instructables.com/lesson/YourFirstExperiments/ 16/29
11/12/2016 YourFirstExperiments
Let'saddthenewLEDstothethusfarunusedhalfofthebreadboard.Startbyconnectingatidyresistorfrom
ground(socketsalongtheblueline)toarowofthebreadboard.PlugaredLEDintothebreadboard,connectingits
shorter(negative)leadatthesamerowastheresistor.
http://www.instructables.com/lesson/YourFirstExperiments/ 17/29
11/12/2016 YourFirstExperiments
AddtheremainingresistorsandLEDsinthesamepattern.Rememberthatresistorscanplugineitherorientation,
butLEDshavepolarityandonlylightupwhenelectricityflowsinoneparticulardirectionthroughthem.
http://www.instructables.com/lesson/YourFirstExperiments/ 18/29
11/12/2016 YourFirstExperiments
MovetheyellowwirefromArduinopin13topin7.ConnectanotheryellowwirefromArduinopin6tothepositive
leadofthenextneighboringLED.
http://www.instructables.com/lesson/YourFirstExperiments/ 19/29
11/12/2016 YourFirstExperiments
ConnectupmoreyellowwiresaccordingtothecircuitdiagramintheAutodeskCircuitsmodule(Arduinopins35to
theremainingLEDs'positiveleads).
Clickthe"StartSimulation"buttontoseewherewe'regoingwiththecodesideofthings.Theprogramlightsupone
LEDatatime,inorder,downthelineandbackagain.Clickthe"CodeEditor"buttontoseethecode,andthenclick
the"DownloadCode"button.ThisexamplevariesslightlyfromasimilarexamplethatcomeswiththeArduino
software,sowe'llusethisdownloadableversioninstead.Doubleclickonthe.zipfiletoexpandit,anddoubleclick
onthe"ForLoopIteration.ino"filetoopenit.
http://www.instructables.com/lesson/YourFirstExperiments/ 20/29
11/12/2016 YourFirstExperiments
ClickOKifyouseeaprompttoputtheprograminitsownfolder.Ifyourresultingfilehasallthecodebunchedup
ononeline,youareprobablyusinganoldversionofArduino,andshouldupdatetothelatestversion.Ifyouprefer,
youmayalsoselectandcopythecodefromthemoduleaboveandpasteitintoanew(blank)Arduinosketch(File
>New,thenreplacethedefaultcontentswiththecodeyoucopiedfromabove).
PluginanduploadthecodetoyourArduinoUnoboard.Youmayhavetoselectyourportagainfromthetoolsmenu
afterreplugging.Let'slearnhowtocodealightsequencebytakingacloserlookattheprogramelements:
/*
ForLoopIteration
http://www.instructables.com/lesson/YourFirstExperiments/ 21/29
11/12/2016 YourFirstExperiments
Demonstratestheuseofafor()loop.
LightsmultipleLEDsinsequence,theninreverse.
Thecircuit:
*LEDsfrompins3through7toground
created2006
byDavidA.Mellis
modified30Aug2011
byTomIgoe
Thisexamplecodeisinthepublicdomain.
<ahref="http://www.arduino.cc/en/Tutorial/ForLoop"><a
href="http://www.arduino.cc/en/Tutorial/ForLoop">http://www.arduino.cc/en/Tutorial/ForLoop
</a>
</a>
*/
Thisfirstpartisjustalongcomment.Youalreadylearnedaboutsinglelinecomments,andnowyouknowabout
multilinecomments,signifiedwitha/*tostartand*/tostop.
inttimer=200;//Thehigherthenumber,theslowerthetiming.
Avariableisdeclared!It'sanintegercalled"timer",andthislinesetsitequalto200.Asyoumayhavenoticed,most
linesofArduinoprogramsendwithasemicolon.WhenwritingandmodifyingyourownArduinosketches,watchout
formissingsemicolonsastheywillcausecompilingerrorsthatwilltripyouup.
voidsetup(){
//useaforlooptoinitializeeachpinasanoutput:
for(intthisPin=3;thisPin<8;thisPin++){
pinMode(thisPin,OUTPUT);
}
}
Thesetupconfigurespins3through7asoutputsusingaforloop,whichisaspecialloopthatrepeatsasmall
sectionofcodeacertainnumberoftimesbasedonacondition,usinganincrementcounter.Eachtimethrough
theminiloop,theconditionistestedandiftrue,willcontinueontoexecutethecodeinside.Soabove,avariable
thisPinissetto3,theconditionisthatthisPinshouldbelessthan8,andtheincrementcounterincreasesthisPin
byoneeachtimethroughtheloop(thisPin++isthesameassayingthisPin=thisPin+1).Sothefirsttime
throughthisloop,pin3issettoanoutput.Thesecondtimethrough,pin4issettoanoutput.Andsoforthuntil
thisPinis8,atwhichpointtheconditionisfalseandthecodediscontinueslooping,continuingonwiththerestofthe
program.Thismayseemlikeaconvolutedwaytodoasimplething,butprogrammersloveefficiency!Youcouldjust
aseasilyaccomplishthepinconfigurationswiththefollowingsetup:
voidsetup(){
//initializeeachpinasanoutput:
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
}
http://www.instructables.com/lesson/YourFirstExperiments/ 22/29
11/12/2016 YourFirstExperiments
You'llnoticethattherewillusuallybemorethanonewaytoaccomplishthesametaskswithArduinoprogramming.
Codingissimilartomakingthingsinyourworkshop:youtendtousewhatevertoolsyouhave.Soletsuseaforloop
forsomethingfun...animation!
voidloop(){
//loopfromthelowestpintothehighest:
for(intthisPin=3;thisPin<8;thisPin++){
//turnthepinon:
digitalWrite(thisPin,HIGH);
delay(timer);
//turnthepinoff:
digitalWrite(thisPin,LOW);
}
Theloopstartsoutwiththesameforloopasearlier,incrementingfromthelowestpinnumbertothehighest.
Insidetheforloop,itturnsontheLEDatthisPin,pausesfor200ms(setearlierastimer),thenturnsthatLEDoff
beforeloopingagainwiththenextLED.
//loopfromthehighestpintothelowest:
for(intthisPin=7;thisPin>=3;thisPin){
//turnthepinon:
digitalWrite(thisPin,HIGH);
delay(timer);
//turnthepinoff:
digitalWrite(thisPin,LOW);
}
}
Thenextpartofthecodeisanotherforloop,butthisonestartsatthehighestpinandusesthisPin,which
meansthesamethingasthisPin=thisPin1(itselfminusone),andexitstheloopwhenthisPinisnolonger
>=3(greaterthanorequaltothree,aka2).Thefinalclosingcurlybraceclosesthemainloop.Sothisprogram
lightsupeachLEDinorder,thenreversestheorderandlightsthemupagain.
Fade
http://www.instructables.com/lesson/YourFirstExperiments/ 23/29
11/12/2016 YourFirstExperiments
TurningLEDsonandoffisgreatandall,butnowlet'smakeanLEDfadeinandoutgraduallyusingafunction
calledanalogWrite();.UnplugyourUSBcableandremoveallbutthefirstLEDfromyourbreadboard,andmove
itsyellowwireconnectiontoArduinopin9.
Copy/downloadthecodefromtheAutodeskCircuitsmoduleoropenuptheexampleinyourArduinosoftware
examplesunderFile>Examples>01.Basics>Fade.
http://www.instructables.com/lesson/YourFirstExperiments/ 24/29
11/12/2016 YourFirstExperiments
PluginanduploadthesketchtoyourArduinoUnoboardandobserveyourLEDfadeonandoff.
Let'slookatthecodetolearnhowthisfadingisachieved.IhaveturnedonlinenumbersintheArduinopreferences
inordertobetterbeabletoreferencethedifferentpartsofthecode.
Lines16through18declarethreevariablesusedintheprogram.Thesetupconfigurespin9asanoutputonline
23.Online29,thefunctionanalogWrite();setspin9towhateverthevariablebrightnessisatthegiventime.On
line32,brightnessisincrementedby5(fadeAmount).Line35usesanifstatementtocheckifbrightnessusing
comparisonoperators.Ifbrightnessislessthanorequalto<=zero,or||greaterthanorequalto>=255.Ifthe
statementistrue,thecodeinsideisexecuted,otherwiseit'sjustskipped.Sothiscodeincreasesbrightnessuntilit
reachesorexceeds255,thensetsfadeAmountto5anddecrementsbrightnessuntilitreacheszero(ordipsbelow
zero).Thedelayattheendpreventsthecodefromrunningsofastthatyoucan'tseetheeffect.Trychangingthe
valueoffadeAmountanduploadthecodetoyourboard.Howdoeschangingthisvariableaffecttheappearanceof
thefading?
TheArduinoboardisonlycapableofgeneratingdigitalsignals(HIGHandLOW),butanalogWrite()simulatesthe
appearanceofbrightnessesbetweenonandoffusingpulsewidthmodulation(PWM).TheLEDflashesonand
offveryquickly,andyoureyeinterpretsadimmerlight.TheratiooftimetheLEDspendsonvs.offdetermineshow
brightordimtheLEDappears.OnlycertainpinsarecapableofPWM,andtheyarelabeledontheboardwith
squiggles~nexttothepinnumber.PWMcanalsobeusedtocontrolthespeedofaDCmotor,whichwe'lldoina
laterlesson.
RGBLEDs
Additive(lightbased)colorhasthreeprimarycolors:red,green,andblue.Simultaneouslycontrollingthebrightness
ofoneLEDofeachofthesecolorscancreatealmostanycoloroflight.ColorchangingLEDslikethoseusedinthe
finalprojectworkthesameway,buttheLEDsarealltogetherinaverysmallpackagecalledanRGBLED.Let's
buildourownRGBLEDfromthree5mmLEDsinyourkits.IntheAdafruitkitrecommendedforthisclass,these
http://www.instructables.com/lesson/YourFirstExperiments/ 25/29
11/12/2016 YourFirstExperiments
threeLEDshaveclearlenses,sowe'llhavetoplugthemintodeterminewhichLEDiswhich.LEDswithclearlenses
canbeanycolor!Ifyou'reusingadifferentkit,justfindonered,onegreen,andoneblueLED(clearorcolored
lens).UnplugyourUSBcableandswapouttheredLEDforoneoftheclearlensLEDs,thenplugtheUSBbackin.
WhatcoloristheLED?Ifyoufindtheredoneonthefirsttry,setitasideandrepeattheprocesstodeterminethe
colorofthetheothertwoLEDs.
WireuptheothertwoLEDswith1Kresistorstopins10and11,asshowninthediagram.Downloadandopenthe
codefromtheAutodeskCircuitsmoduleorcopyandpasteitintoanewemptyArduinosketch.Uploadittoyour
ArduinoUnoboardandseeifyoucanmatchupthelinesofcodetotheactivityyouseeintheLEDs,aswehave
donetogethersofar.
http://www.instructables.com/lesson/YourFirstExperiments/ 26/29
11/12/2016 YourFirstExperiments
http://www.instructables.com/lesson/YourFirstExperiments/ 27/29
11/12/2016 YourFirstExperiments
TheunfamiliarpartofthiscodeisthefunctionsetColor();.It'sacustomfunction,definedbelowtheloop()has
ended.
voidsetColor(intred,intgreen,intblue)
{
analogWrite(redPin,red);
analogWrite(greenPin,green);
analogWrite(bluePin,blue);
}
Afunctiondefinitiondeclaresaname,andwhattypeofargumentsthefunctionwilltake,whichyoucanthinkof
astheconfigurablesettingsyou'llwanttochangeeachtimeyouexecutethecodeitcontains.Inthissimplefunction,
threeintegervaluesarewrittentothethreeLEDpinsusinganalogWrite();.
setColor(255,255,0);//yellow
Eachtimethisfunctioniscalledinthemainloop,theprogramexecutesthecodeinthefunctionbeforecontinuing
throughthemainloop.Inthiscase,theargumentsareusedasthebrightnessesofeachLED.Thescalefor
brightnessis0255becauseeachcolorisdefinedusingonebyte,whichallowsfor256distinctpatterns.
NowdownloadandopenthecodefromthismorecomplexRGBproject,orcopyandpastethecodeintoanew
blankArduinosketch.Readitscommentstolearnmoreabouthowthisprogramworks.Itdoessomemathto
converta0100rangetothenecessaryrangetheLEDsneed,soyoucanthinkinpercentagesinsteadof0255.It
usescollectionsofvariablescalledarraystostorecolors,andthreeuserdefinedfunctionstocalculatevaluesfora
smoothfadebetweencolorssothattheloop()isniceandtidy.crossFade(red);almostreadslikeEnglish!We'll
getintosomeoftheotherunfamiliarkeywordsinthissketchinfuturelessons,butfirstit'stimetocelebrateall
you'veachievedsofar.TakeapictureofoneofyourcircuitsfromthislessonandpostitintheClassProjectmodule
below,soIcangiveyouavirtualhighfive!
PreviousNext
http://www.instructables.com/lesson/YourFirstExperiments/ 28/29
11/12/2016 YourFirstExperiments
http://www.instructables.com/lesson/YourFirstExperiments/ 29/29
11/12/2016 Input/Output
Input/Output
instructables.com/lesson/InputOutput/
InvalidDate
Let'sgetreadytowireupanewcircuit.Grabsomebreadboardwires,aredLED,1Kresistor(brownblackred
gold),10Kresistor(brownblackorangegold),andasmallpushbuttonfromyourkit.Giveyour10Kresistorthe
sameelbow+trimtreatmentasyourothertidyresistors.
http://www.instructables.com/lesson/InputOutput/ 1/6
11/12/2016 Input/Output
First,connecttheLEDtoArduinopin13likeyoudidinyourfirstcircuit,withawirefrompin13tothepositiveleadof
yourLED,anda1KresistorconnectingtheLED'snegativeleadtoground.
http://www.instructables.com/lesson/InputOutput/ 2/6
11/12/2016 Input/Output
Next,pluginthepushbuttonsothatitstraddlesthecenterdividinglineofyourbreadboard.Itshouldclickintoplace
snugly.Connectthe10Kresistorfromoneleadoftheswitchtothebreadboard's5Vpowerrail.Connectawireto
thissamerowandplugitintoArduinopin2.
http://www.instructables.com/lesson/InputOutput/ 3/6
11/12/2016 Input/Output
Connecttheswitch'sdiagonalleadtoground.
Click"StartSimulation"intheAutodeskCircuitsmoduleandtryclickingthepushbuttontoseewhatthecodedoes.
Clickthe"CodeEditor"buttontoseethesketch.
http://www.instructables.com/lesson/InputOutput/ 4/6
11/12/2016 Input/Output
YoucanfindthisexampleintheArduinosoftwarebynavigatingtoFile>Examples>02.Digital>Button.Openit
onyourcomputer,anduploadittoyourArduinoUnoboard.TheLEDshouldlightup,butturnoffwheneveryou
pressthepushbutton.
Followalongasweexplorethecodeinmoredetail.
Thefirstlinesofthisprogramintroduceconstants,whicharesimilartovariablesinthattheystoreapieceof
information.Howeverasyoumightinfer,constantsdon'tchangethroughoutyourprogram,andarethereforegreat
forthingslikepinnumbers.Theytakeuplessmemoryspacethanvariables.Row39configuresArduinopin2asan
input,sowecan"listen"totheelectricalstateofthepushbutton.
Inthemainloop,afunctioncalleddigitalRead()checksthestateofpin2(whichwillbeeither5VakaHIGHor
groundakaLOW),andstoresthatstateinavariablecalledbuttonState.Row48containsanifstatementthat
checkstoseeifbuttonStateisHIGH(==isacomparisonoperator,nottobeconfusedwith=,whichisan
assignmentoperator).Iftheconditionismet,thedigitalWrite(ledPin,HIGH);commandisexecuted.Ifnot,the
codecontainedinsidetheelse{isexecutedinstead:digitalWrite(ledPin,LOW);.Ifstatementscanexist
alone,orwithoneormoreelsestatements.
Haveyounoticedthatyourpushbuttoncircuitperformstheoppositeactionfromthatdescribedinthecode?Idid
thatonpurposetostretchyourmentalmuscleslet'sdiscusstheswitchcircuitsomemore.Atrest,theswitchleads
arenotconnectedtooneanother.Pin2isconnectedthroughabeefy10Kresistorto5V.Whenthebuttonis
pressed,theswitchleadsareconnected,whichallowspin2tobeconnectedtoground,withnoresistor.Since
electricitytakesthepathofleastresistance,thepinwillsensetheconnectiontogroundstrongly,andignorethe
http://www.instructables.com/lesson/InputOutput/ 5/6
11/12/2016 Input/Output
weak(10K)connectionto5V.Butwhennoothersignalispresent(whentheswitchisn'tbeingpressed),thatweak
connectionto5Visallthepincansense.Sotheresistoris"pullingthepinup"to5V,andsoit'scalledapullup
resistor.Withoutone,pin2wouldbenotconnectedtoanythinguntilthebuttonispressed.Thisiscalled"floating",
andcanresultinrandomnoisefromstaticelectricityandelectromagneticinterference.Similarlyaresistorcanbe
usedtotieapintoground,whichiscalledapulldownresistor.
Sotochangethefunctionofthebutton,youcaneitherchangethewiringofyourcircuit,orchangethecode.The
latterislessworkinthiscase,butit'simportanttorememberthatmightnotalwaysbethecasewhenyou'rebuilding
projectsonyourown.Editlines47(comment)and48(ifstatement)tosayLOWinsteadofHIGH:
voidloop(){
//readthestateofthepushbuttonvalue:
buttonState=digitalRead(buttonPin);//checkifthepushbuttonispressed.
//ifitis,thebuttonStateisLOW:
if(buttonState==LOW){
//turnLEDon:
digitalWrite(ledPin,HIGH);
}
else{
//turnLEDoff:
digitalWrite(ledPin,LOW);
}
}
UploadtheupdatedsketchtoyourArduinoUnoboard,andcheckthatthebuttonnowturnstheLEDoninsteadof
off.
Arduinopinshavebuiltinpullupresistorsonmanyofthepins(tinyones,insidethechipjustforthispurpose),and
youcanaccessonebyenablingitinthesetup:
pinMode(buttonPin,INPUT_PULLUP);
Changethislineofcodeinyoursketchandremovetheresistorfromyourcircuit.Uploadthecodeitsbehavior
shouldremainthesame.
http://www.instructables.com/lesson/InputOutput/ 6/6
11/12/2016 SkillsInfusion
SkillsInfusion
instructables.com/lesson/SkillsInfusion/
InvalidDate
sharewhatyoumake
SkillsInfusion
withbekathwia
Inthislesson,we'llcoverafewimportantconceptsyou'llneedtounderstandtocreateyourownArduinoprojects.
We'llgetuptospeedonsoldering,codelibraries,addressableLEDs,organizingcodewithfunctions,andcalculating
thepowerrequirementsofyourprojects.
Supplies
Tofollowalongwiththislessonyouwillneed:
http://www.instructables.com/lesson/SkillsInfusion/ 1/15
11/12/2016 SkillsInfusion
Soldering
Solderingisanextremelyusefulelectronicsconstructiontechnique,andit'ssurprisinglysatisfyingtodo.Itdoes
takepracticetoexcel,likemostworthwhileendeavors,sotakeamomenttosetyourintentionforthislesson.
Establishagoaltokeeptryingevenifyoubecomefrustrated,andbekindtoyourselfduringtheprocess.Andwear
eyeprotectionnobodywantshotbitsofmetalintheireyes!Whilewe'retalkingsafety,workinaventilatedarea
andwashyourhandsafterwards,especiallybeforetouchinganyfood.Becautiousandalertaroundyoursoldering
ironkeepburnablethingsawayfromthehotpart(includingyourskin),andturnitoff(orunplugit)ratherthanleave
itunattended.
We'llusesolderingtoattachwiresontoapieceofNeoPixelstrip,sowecanplugitintothesolderlessbreadboard.A
basicsolderingironliketheonerecommendedforthisclasswilltakeyouquitefar,andifyoudoupgradetoa
temperatureadjustablesolderingstationlikemine,youcankeepyourbasicironasaspareorgiveittoafriend.
Plugitin,turniton,andletitheatupforafewminutes(mineissetto650degreesF).Keepadampspongeor
brassspongenearby(manysolderingironstandscomewithasmallsponge).Whentheironishot,cleanthetip
withafewwipesacrossthespongeorstabsintothebrasscoilsponge.Thentouchtheirontoyoursolderfora
momenttotransferalittlebitofsoldertothetip,calledtinningthesolderingiron.Repeatthiscleaningandtinning
procedureregularlywhileusingthesolderingirontopreventbuildupofexcesssolderandoxidation.
http://www.instructables.com/lesson/SkillsInfusion/ 2/15
11/12/2016 SkillsInfusion
Solderingworksbyheatingupthemetalcomponentstobejoined,thenallowinglowtemperaturealloysolderto
meltandflowandhardenbetweenthem.Solderisnotglue.Ifyoumeltsolderontothetipandthensmearitaround
thecomponentleads,youwillnotcreateagoodelectricalconnection.
Solderisusedwithflux(usuallybuiltrightintothesolder,labeled"rosincore"),whichisasubstancethathelps
delayoxidation.Itshieldstheimmediateareaofthebondingmetals,andboils/burnsawayastheycool.Solder
fumesaremainlytreesap,whichfluxismadefrom.Ifyouapplymoltensoldertocoldcomponents,itcould
potentiallylooksoldered,butalayerofoxidationishiddeninside,createdwhenthesoldersuddenlycooledasit
touchedthebasecomponent.Thisiscalledacoldsolder,whichpreventselectronsfromflowingacrossthesolder
joint.Alwaysheatyourcomponentsfullybeforeapplyingadditionalsolder!Goodsolderjointswilllooksmoothand
shiny,notblobbyordull.
Athirdhandtoolhelpsimmenselywhenitcomestostabilizingyourwork,especiallyasyou'relearningtoholdthe
ironsteady.Itendtoavoidcaffeinearoundworkshoptime,too.Iliketoputalittlebitofheatshrinktubingoverthe
jawsofmythirdhandtool,tosoftenitsbite.
Prepthreeofyourbreadboardwiresbycuttingofftheconnectorsatoneendandstrippingtheendstoexposethe
barestrandsofwire.Twistthestrandsofeachwiretokeepthemtogether,thenheatupthewirewithyoursoldering
ironandapplyasmallamountofsolder.Removethesolderbeforeremovingtheiron,togivethemoltensolderone
lastmomenttosettlein.Repeattotinyourothertwowires,thensetthemaside.
http://www.instructables.com/lesson/SkillsInfusion/ 3/15
11/12/2016 SkillsInfusion
CutapieceofyourNeoPixelstrip19pixelslong,using
yourflushdiagonalcutterstoclipstraightacrossthe
middleofthecopperpads.Removeitfromthesilicone
sheathingandidentifytheinputthearrowmarkings
onthestrippointawayfromit.Cliptheinputenditinto
yourthirdhandtoolwiththebackofthestripfacing
you.Tinthecentercopperpadbytouchingyour
solderingirontoit,thenapplyingasmallamountof
solder.Moveyourtiparoundthecopperpadtospread
thebeadofsolderaround.
Nowthatyourtwocomponentsaretinned,itwillbe
easiertosolderthemtogether.Pickupayourwhite
wireinonehandandyoursolderingironintheother.
Holdthetinnedwireendtothetinnedcopperpad,and
reheatthetwocomponentsatthesametime.The
solderoneachshouldflowtogether,ifitdoesn't,you
mayneedtoapplysomemore.Removeyouriron
beforelettinggoofthewire,sothesolderhasa
chancetocool,securingthewireinplace.Ifyoufindit
difficultortoohottoholdthewirewithyourfingers,use
apairoftweezersorpliers.
FlipoveryourNeoPixelstripandsimilarlytinand
solderwirestotheothertwocopperpads(redwirefor
5V,blackwireforGND).Itdoesn'treallymatterwhich
sideofthecopperpadyousolderto,butalternating
sidesgivesyoursolderjointsalittlemoreelbowroom.
Trimanyexcesswireprotrudingfromthecopperpad.
Nowyou'rereadytoplugthestripintoyour
breadboardandgettheLEDsglowing(we'lldothat
next)!
Ifyoumakeamistake,applytoomuchsolder,orjust
wanttodisassembleyourwork,youcandesolderthe
jointbysimplyreheatingitandpullingthewireaway.
Formoreentangledcomponents,youcanusecopper
desolderingbraidtoremoveexcesssolder(itshighly
interleavedsurfaceareadrawsthesolderinwith
capillaryaction),orasuctiondesolderingpump.
http://www.instructables.com/lesson/SkillsInfusion/ 4/15
11/12/2016 SkillsInfusion
http://www.instructables.com/lesson/SkillsInfusion/ 5/15
11/12/2016 SkillsInfusion
http://www.instructables.com/lesson/SkillsInfusion/ 6/15
11/12/2016 SkillsInfusion
Practiceyoursolderingskillsagainbyattachingwirestotwodiagonalleadsofapushbutton.Tinthewiresandthe
pushbuttonleads,thenreheatthemtoallowthesoldertoflow.Setthispushbuttonasideforthefinalproject.
AddressableLEDsandCodeLibraries
http://www.instructables.com/lesson/SkillsInfusion/ 7/15
11/12/2016 SkillsInfusion
Nowthatthestripissoldered,we'llneedtoprogramtheArduinototurntheLEDson.NeoPixelistheAdafruitbrand
nameforWS2812addressable"smart"LEDstrip(asopposedtoanalogLEDstrip).Eachpixelhasachipinsideto
communicatewiththeArduinoboardandotherpixelsonitsstrip(itcan'tlightupwithoutacontroller).Tocontrolthe
strip,someadditionalArduinofunctionsarerequired,andwecangetthembyinstallingthecodelibrary.Arduino
codelibrariesempoweryoutoleveragepowerfulcomputingtoolsusingsimplecommands.Arduinorecognizes
theseaddonmodulesandthenyoucanusetheircommandswithinyourprogram.Arduinolibrariesexistforall
sortsofcomplextasks,likecontrollinglargeLEDpanels,readingsensors,creatingsounds,andmanymore.
InyourArduinosoftware,navigatetoSketch>IncludeLibrary>ManageLibraries...
http://www.instructables.com/lesson/SkillsInfusion/ 8/15
11/12/2016 SkillsInfusion
WhentheLibraryManageropens,searchfor"NeoPixel"intheupperrightfield.Optionallyselectaversionofthe
libraryfromthedropdownmenu,andclickthe"Install"button.Nowyou'reallsettousetheNeoPixellibraryinyour
Arduinosketches!YoucanusethelibrarymanagertoinstallallkindsoffunextensionstotheArduinoprogramming
languagethathelpyouinterfacewithsensors,motors,andmore.
Takeacloselookatyourpixelstrip.EachpixelcontainsaverysmallRGBLED,whichcantheoreticallycreateany
coloroflight.However,generatingpurewhiteposesachallengeforRGBLEDsandoftenleavesusersdisappointed
inthetintedorpoorlymixedqualityoflightproduced.Forthisreason,theRGBWstripincludesawhiteLEDinside
itspackageaswell.
http://www.instructables.com/lesson/SkillsInfusion/ 9/15
11/12/2016 SkillsInfusion
Codingforthesepixelswillincludefourbrightnessvaluestodescribeapixelcolor:red,green,blue,andwhite.This
issimilartoanalogWrite()intheRGBLEDexamplefromyourfirstexercises:youprovideanumberfrom0255to
representthebrightnessoftheLED.ThefunctionsintheNeoPixellibrarytakepixelnumbersandthesecolorvalues
asarguments,thentranslatethemintothecommandstosendalongtheLEDstrip.
http://www.instructables.com/lesson/SkillsInfusion/ 10/15
11/12/2016 SkillsInfusion
NowthatourNeoPixelstriphaswiresattachedtoit,let'sconnectittothebreadboard.The5Vwire(red)goesto
yourbreadboard'spowerbus,andthegroundwire(black)goestothebreadboard'sgroundbus.Connectthedata
wire(white)toArduinopin6.
Download/copythecodefromtheAutodeskCircuitsmoduleandopenitinyourArduinosoftware.PluginyourUSB
cableanduploadtoyourArduinoUno,andwatchthepixelslightupandchangecolors.
Let'stakealookattheArduinosketch:
#include<Adafruit_NeoPixel.h>
#definePIN6
#defineNUM_LEDS19
#defineBRIGHTNESS50
//Parameter1=numberofpixelsinstrip
//Parameter2=pinnumber(mostarevalid)
//Parameter3=pixeltypeflags,addtogetherasneeded:
//NEO_RGBPixelsarewiredforRGBbitstream
http://www.instructables.com/lesson/SkillsInfusion/ 11/15
11/12/2016 SkillsInfusion
//NEO_GRBPixelsarewiredforGRBbitstream,correctifcolorsareswappedupontesting
//NEO_RGBWPixelsarewiredforRGBWbitstream
//NEO_KHZ400400KHzbitstream(e.g.FLORApixels)
//NEO_KHZ800800KHzbitstream(e.g.HighDensityLEDstrip),correctforneopixelstick
Adafruit_NeoPixelstrip=Adafruit_NeoPixel(NUM_LEDS,PIN,NEO_GRBW+NEO_KHZ800);
ThefirstsectioninstantiatestheNeoPixelstripandsetsuptheconfigurablebitsoftheprogramlikethepins
connectedtotheNeoPixelstripandbutton,thenumberofpixels,andglobalbrightnesslevel.#definestatements
aresimilartovariabledeclarations,butareusedforinformationthatdoesnotchangewhiletheprogramisrunning.
Theytakeuplessmemorythanregularvariabledeclarations.
voidsetup(){
strip.setBrightness(BRIGHTNESS);
strip.begin();
strip.show();//Initializeallpixelsto'off'
}
strip.show();isusedanytimeyouwantthepixelstochange.Settingthepixelcolorsandshowingthelatest
changesarebrokenupintotwoseparatecommands.
voidloop(){
//Someexampleproceduresshowinghowtodisplaytothepixels:
colorWipe(strip.Color(255,0,0),50);//Red
colorWipe(strip.Color(0,255,0),50);//Green
colorWipe(strip.Color(0,0,255),50);//Blue
colorWipe(strip.Color(0,0,0,255),50);//White
whiteOverRainbow(20,75,5);
pulseWhite(5);
//fullWhite();
//delay(2000);
rainbowFade2White(3,3,1);
}
Themainloopjustcallsotherfunctions.Let'stakeacloserlookatcolorWipe();,definedjustbelowthemainloop,
andtakestwoarguments:acolor(strip.Color(r,g,b,w)),andaspeedvalue.
//Fillthedotsoneaftertheotherwithacolor
voidcolorWipe(uint32_tc,uint8_twait){
for(uint16_ti=0;i<strip.numPixels();i++){
strip.setPixelColor(i,c);
strip.show();
delay(wait);
}
}
Thefunctiondefinitionstartswithwhattypeofdatathefunctionwillreturn,orsendbacktothemainprogram.In
thiscasethefunctionreturnsnothing,sothewordvoidisusedatthestartofthedefinition.Nextisthenameofthe
function,whichisuptoyou.Theninparenthesesaretheargumentsthefunctiontakes,inthiscasea32bit
http://www.instructables.com/lesson/SkillsInfusion/ 12/15
11/12/2016 SkillsInfusion
unsignedintegercalled"c"andan8bitunsignedintegercalled"wait."Insidethefunction,theselocalvariablesare
usedtoreferencetheinformationyoupassedtoitfromthemainloop(orfromanotherfunction).Thefunctionitself
stepsthroughallthepixelsinthestrip(usingaforloopandaNeoPixelfunctioncalledstrip.numPixels();),
coloringandshowingeachonebeforemovingtothenext.TheotherfunctionsintheRGBWstrandtestprogram
workthesameway,anduseclevercolormathtoachievestunninglightpatterns.
WriteYourOwnFunctions
YoucaneasilymodifycolorWipe()tostartcodingupyourownuniqueanimation.Trycopyingthewholefunction
definition,andchangethenameofthefunction(orcopyandpastethissnippetjustaftertheclosingcurlybraceof
yourmainloop).
//myfirstNeoPixelanimation
voidanimationExperiment(uint32_tc,uint8_twait){
for(uint16_ti=0;i<strip.numPixels();i++){
strip.setPixelColor(i,c);
strip.show();
delay(wait);
}
}
Thenstartplayingaroundwiththecode.SayIwanttolightuparandompixelinthestripinsteadoflightingthemup
inorder.IcoulduseArduino'sbuiltinrandom()functiontopickapixel,whichgeneratesarandomnumberbetween
thetwoarguments:
strip.setPixelColor(random(0,strip.numPixels()),c);
Callyournewfunctioninsideyourmainloop:
voidloop(){
animationExperiment(strip.Color(255,0,0),50);//Red
}
RepeatedlyuploadyourcodeexperimentationtoyourArduinoUnoboard,makingsmallchangeseachtime.Ifyou
findaneffectyoulike,stopeditingthatfunctionandcreateanewone,eitherbycopying/pastingafunctionand
changingitsname,ortypingoutthedefinition:
voidfunctionName(){
//contents
}
Congrats,that'sallthereistocreatingfunctionsinArduino!They'reahandytooltoseparateoutachunkofcode
youwanttoaccessrepeatedly,andmakeyourcodeeasiertoread.
PlanningforPower
http://www.instructables.com/lesson/SkillsInfusion/ 13/15
11/12/2016 SkillsInfusion
AswetouchedonintheDCmotorandNeoPixelcircuits,it'slikelyyou'llwanttopoweryourArduinoprojectwith
somethingotherthanyourUSBcable.Whetheryou'rebuildinganLEDsignthatplugsintothewall,orabattery
poweredGPScircuitforyournextgeocachingadventure,justabitofsimplemathwillhelpyoupicktherightpower
supplyeverytime.Allyoudoisaddupthecurrentdrawofeachcomponent,andpickasupplythatmatchesor
exceedsyouramperageneeds.Componentslisttheircurrentdrawonproductpagesanddatasheets.Forexample,
10LEDsthateachdraw~20mA,whenhookeduptoanArduinoboardthatdraws~50mA.10*20+50=250mA.A
250mAhbatterywillrunthiscircuitforonehour.TherechargeableAApackinthepictureaboveprovides1900mAh,
soitcanpowerthecircuitfor1900mAh/250mA=7.6hours.Whenhookingbatteriesupinseries,theirvoltageadds
upbuttheiramperagedoesnot(4AAbatteriesis4x1.5Vbutnot4x1900mAh).
Inrealityyourcircuitmayusefarlesspowerthanthecalculatedmaximum.LEDsthataredimmedwithPWMonly
useafractionofthepowerofthoseatfullbrightness,forexample.Havingmorecurrentavailablethanyouneed
isn'tabadthing,asithelpspreventovertaxingyoursupply.Circuitsonlydrawasmuchpowerastheyneed!
FormostArduinoprojects,a4xAAor3xAAApackwillsuffice.YoucanconnectdirectlytotheArduino's2.1mmbarrel
jackwithabatterypackorwallsupply,orplugtheUSBcableintoawalladapter.ManysmallerArduinocompatible
boardshaveJSTportsonboard,acommonconnectorforlipolybatteries.SomeevenhaveUSBchargingrighton
theboard!Lipolybatterieshavespecialsafetyconcerns,sobesurenottoshortcircuitorabusethem,storethemat
extremetemperatures,andreadanymanufacturers'safetywarningsbeforeworkingwiththem.
Let'swrapupthisskillsinfusionwithalittlerecapquizonwhatyou'velearnedsofar!
http://www.instructables.com/lesson/SkillsInfusion/ 14/15
11/12/2016 SkillsInfusion
PreviousNext
http://www.instructables.com/lesson/SkillsInfusion/ 15/15
11/12/2016 Project:InfinityMirror
Project:InfinityMirror
instructables.com/lesson/ProjectInfinityMirror/
InvalidDate
sharewhatyoumake
Behold!Lookdeepintotheenchantinganddeceptivelysimpleinfinitymirror!AsinglestripofLEDsshineinwardon
amirrorsandwichtocreatetheeffectofendlessreflection.Thisprojectwillapplytheskillsandtechniquesyou've
learnedsofar,andputitalltogetherintoafinalformusingasmallerArduinoGemmaboard.
Supplies
http://www.instructables.com/lesson/ProjectInfinityMirror/ 1/35
11/12/2016 Project:InfinityMirror
Tofollowalongwiththislessonyouwillneed:
Sharputilityknife
MetalrulerorTsquare
Cuttingmatorscrapcardboard
Printerfortemplateorcircledrawingcompass
Plasticscoringknife(optionalbutnice)
Hotmeltgluegun,orE6000/QuickHoldcraftadhesive
Clothespin(optional,touseasaglueclamp)
4"roundmirror
Seethroughmirrorplastic
Blackfoamboard,3/16"thickness
ArduinoUnoandsolderlessbreadboardonamountingplate
USBABcable
Smallpushbutton(thatyousolderedearlier)
Breadboardwires
http://www.instructables.com/lesson/ProjectInfinityMirror/ 2/35
11/12/2016 Project:InfinityMirror
RGBWNeoPixelstrip(orotherWS2812bRGBWLEDstrip)(19pixels,usesthesamestripyousoldered
earlier)
Solderingiron&solder
Wirestrippers
Flushdiagonalcutters
Thirdhandtool
Multimeter(optional)
Smallneedlenosepliers
Tweezers
ArduinoGemmaboard
MicroUSBcable
USBhub,ifyourcomputerhasUSB3portsonly(suchasnewerMacs)
USBextensioncable(optional)
USBpoweradapter
Lipolybattery&charger(optional)
CutFramePieces
http://www.instructables.com/lesson/ProjectInfinityMirror/ 3/35
11/12/2016 Project:InfinityMirror
Getreadyforsomepapercraft!Thisstepinvolvessharptoolsandrequiresattentiontodetail,sobesureyou're
wellrested,butnotoverlycaffeinatedeither.Usebrightlightingandalarge,cleanworksurfaceprotectedbya
cuttingmatorscrapcardboard.
Ifyou'renewtocuttingandglueingfoamcoreboard,getextraforpracticeandmistakesathreepackof16x20in
boardsshouldsuffice(andyoucanmakeotherprojectswithitifyouhaveextraleftover).Topreventinjury,usea
sharpblade,ametalruler,aslowpace,andplentyofcaution.It'snormaltoremakeafewpiecesduetoanerrant
bladesliporsnag.
Therearetwowaystocreatetheshapesyou'llbecutting:printoutthetemplate,ordrawtheshapeswithacircle
drawingcompass.Thereisnodistinctadvantageineither,butyourskillsandtoolsmightswayyouonewayorthe
other.ThetemplateisavailableasatiledPDFforlettersizedpaper,whichyou'lltapetogetheranduseagluestick
toadhereittoyourfoamcore.There'salsoanuntiledversionofthetemplatefileincaseyouwanttoprintitona
largeformatprinterormakechanges.
It'sreallysimpletodrawtheshapesbyhand,though,Ipromise!Firstdrawacircletomatchyourmirrorsizeby
settingthecompasstoitsradius(4"mirror=2"radius)anddrawingacircleonyourfoamcoreatleast5inchesfrom
eachedge.Sure,youcouldjusttracethecircumferenceofthemirror,butthenyou'dhavetofindandmarkthe
center!Thecompassmakesanindentationatthecenterpointthat'shandyformakingthesecondconcentriccircle.
Nowwidenyourcompassto4"anddrawoutthebiggercirclearoundthefirst.Thisisthecompletebottom/backof
yourmirrorlabelitassuch.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 4/35
11/12/2016 Project:InfinityMirror
Thetop/frontpieceneedstobejustabitbigger,so
widenyourcompassto43/16"anddrawitoutata
safedistancefromthebottompiece.
Theviewingwindowshouldbejustslightlysmallerthan
themirror,thoughit'snotimportantexactlyhowmuch.
Setyourcompasstoabout1/8inchsmallerthanthe
mirrorradius,andthendrawoutthecircleusingthe
samecenterpointasthelargerfront/topperimeter.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 5/35
11/12/2016 Project:InfinityMirror
http://www.instructables.com/lesson/ProjectInfinityMirror/ 6/35
11/12/2016 Project:InfinityMirror
http://www.instructables.com/lesson/ProjectInfinityMirror/ 7/35
11/12/2016 Project:InfinityMirror
Labelthispiecewithinthesmallercircle,whichwillbecutawayinafewmoments.
Alongonelongsideofyourfoamcore,markandcut
onestripat1/2"wide,andanotherat1"wide.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 8/35
11/12/2016 Project:InfinityMirror
ThenarrowstripwillhugthemirrorandsupportyourNeoPixelstrip,whilethewideronewillformtheouterwallof
thecircularframe.
Ontocuttingthecircles!Somefinesseandpatiencearehelpfulhere.Iliketouseasmallercraftknifeforcutting
circlesbecauseIfeellikeIhavemorecontrol.TheparticularknifeI'musingheretakesregularXactoblades,andI
http://www.instructables.com/lesson/ProjectInfinityMirror/ 9/35
11/12/2016 Project:InfinityMirror
founditinthescrapbookingaisle.
First,lightlydragyourknifearoundtheentire
circumferenceofthebottompiece,onlypiercingthe
toplayerofpaper.Duringthispassyou'refreetoangle
thebladehoweverismostcomfortableandproduces
themostpreciseshape.
Cutaroundthecircleonceagain,tracingthelineyou
madeinthepreviouspass.Thistime,payattentionto
yourbladeangle,whichshouldbe90degrees(straight
upanddown).Pressfirmlyasyoumakethiscut,and
keepyourfingersoutofthebladepath.Pickupyour
boardandchecktoseeifyoucutallthewaythrough.
Makeonemorepasswithyourbladetocutthrough
anyremainingspotsalongtheperimeter.
Nextup,cutoutthetoppiece,andthencutoutits
innercircle.Thispieceisseenmorethananyother,so
giveitalittleextracleanuptostraightenupanyedges
thatareuneven.
Forthecurvedinnerring,makecrosscutsevery1/4"
orsoalongthethinnerfoamcorestrip,butdon'tcutall
thewaythrough!It'seasierthanitsoundsjustmake
twolightpassesandyou'llgetthehangofitquickly.
Thesecutsallowthepiecetocurvewhileprovidinga
smoothinteriorsurface.
Theouterframepieceneedstoputit'sbestface
outward,sowe'llmakecrosscutsinaslightlydifferent
pattern.Firstprepforthelapjointbyscoringaline
3/16"fromtheedge.Makegentlecrosscutsalongthe
strip,alternatingthickandthinsectionsabout3/8"and
1/8",respectively.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 10/35
11/12/2016 Project:InfinityMirror
http://www.instructables.com/lesson/ProjectInfinityMirror/ 11/35
11/12/2016 Project:InfinityMirror
http://www.instructables.com/lesson/ProjectInfinityMirror/ 12/35
11/12/2016 Project:InfinityMirror
Toremovethematerialwheretheedgewilllap,placethestripalongthecuttingsurfaceedgeandslideyourknife
horizontallytoshedthefoamexcess,leavingthebottomlayerofpaperintact.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 13/35
11/12/2016 Project:InfinityMirror
Nowremovethethinsectionsbyyankingthemoutwithapairoftweezersorpliers.Theyreleasewithasatisfying
poppingsound.Withthatextraspace,thestripcannowcurveinonitselfandformthecleanoutershellofthe
project!
Cutapieceofyourseethroughmirrorplastictobe
largerthanyourmirror,butsmallerthantheouter
frame.Don'tbothertryingtocutitinacircle.Ifyou
haveaplasticscoringknife,that'sbest.Dragthe
gougealongyourrulerafewtimes,thensnapthe
plasticalongthescore.Howeverautilityknifeeasily
cutsthisthinmaterialaswell,albeitwithsomeflaking
ofthemirrormaterialalongthecutedge,whichwillbe
hiddeninsidetheframeanyway.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 14/35
11/12/2016 Project:InfinityMirror
AssembleFrame
Protectyourworksurfacewithsomescrapmaterial.Heatupyourgluegunandprepabowloficewatertokeep
nearby,incaseyouburnyourself.Youcanusedifferentadhesive(s)forthisprojectifyouprefer.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 15/35
11/12/2016 Project:InfinityMirror
Applyadollopofglueonthecenterofthebottomcircle
andstickyourmirrortoit.Rotateandsquishthemirror
againstthefoamcoregently,aligningitwiththemarked
circle.Thenglueyourthinstriptotheperimeterofthe
mirrorandtearoffanyexcess,leavingasmallgapfor
wirestopassthrough.
Placeyourfront"donut"piecefacedownonthework
surfaceandglueonthelappededge.Repeatedly
pressthesepiecestogetheranddownonthework
surfaceasyougluearoundthego,sothefrontedge
turnsoutniceandclean.Theouterrimwon'tgoallthe
wayaroundandthat'sokyoucanchoosetoclose
upthisgaplaterifyouwant.
RoutetheNeoPixelstrip'swiresthroughthesmallgap
onthemirrorrim,andglueittotheinterior.Optionally
useaclothespintoclampthestripwhilethegluecools.
Trytoavoidgettinghotglueonthemirror,butifyoudo
it'sok!Alittlerubbingalcoholwillreleaseitsholdon
nonporoussurfaceslikeglass.
Cleanyourworkareatoremovedustandbitsof
foamcore.Usealintfreeclothtowipethemirror
completelyclean,thengrabyourseethroughmirror
andpeeltheprotectivecoverfromoneside.Applya
smallamountofglueatfourpointsaroundtheinner
wall(keepyourgluegunmotionsfromdraggingover
themirrortoavoidstraystrands),andgluethesee
throughmirrorinplace.Nowyourreflectivesurfaces
aresealedandprotectedfromdust.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 16/35
11/12/2016 Project:InfinityMirror
http://www.instructables.com/lesson/ProjectInfinityMirror/ 17/35
11/12/2016 Project:InfinityMirror
http://www.instructables.com/lesson/ProjectInfinityMirror/ 18/35
11/12/2016 Project:InfinityMirror
BaskinthedoublereflectivitybypluggingyourNeoPixelstripintoyourArduinoboardasinthepreviouslesson.
CircuitDiagram&Pseudocode
http://www.instructables.com/lesson/ProjectInfinityMirror/ 19/35
11/12/2016 Project:InfinityMirror
Althoughyou'rewelcometoreferencethediagramshownherethroughoutyourbuild,Ihighlyencourageyouto
drawyourown.You'llhaveanataglancereferenceasyoubuildyourbreadboardandfinalprototypes,and
diagrammingyourcircuitswillmakeiteasiertodesignyourownprojectsinthefuture.Thepurposeofacircuit
diagramistoshowalltheelectricalconnectionsinacircuit,notnecessarytheirphysicalpositionsororientations.
Theconnectionsareasfollows:
NeoPixel5V>Arduino5V
NeoPixelGND>ArduinoGND
NeoPixelDin(datain)>ArduinodigitalI/Opin(configurable)
onesideofmomentarypushbuttonswitch>ArduinodigitalI/Opin(configurable)
othersideofmomentarypushbuttonswitch>ArduinoGND
ThiscircuitcombinesNeoPixelstripwithapushbuttonfortriggeringdifferentLEDanimations,andwillusean
internalpullupresistorlikeyousawintheinput/outputlesson.Usingallthisinformation,wecanwriteahuman
readablemockupofourArduinoprogram,called"pseudocode:"
Variables:NeoPixelpinnumber,buttonpinnumber,howmanyLEDsthereare,howbrighttheLEDsshouldbe
http://www.instructables.com/lesson/ProjectInfinityMirror/ 20/35
11/12/2016 Project:InfinityMirror
Onetimetasks:initializebuttonpinasinputwithinternalpullupresistor,initializeNeoPixelstrip,describeLED
animations
Loopingtasks:checktoseeifbuttonhasbeenpressedandifithas,switchtoadifferentLEDanimation
Itmightseemsimple,buttakingthetimetowritepseudocodeforyourprojectwillhelpyouwriteyourfinalArduino
sketchfasterandwithlessconfusion.Itfunctionsabitlikeatodolistaswellasareferenceguideforwhenyou're
swimmingincodeandcan'trememberwhatyou'retryingtoaccomplish!
BreadboardPrototype
GrabyourArduinoandbreadboard,andmakesuretheUSBcordisunplugged.AreyourNeoPixelsstillpluggedin
fromthelastbreadboardexercise?Great!Ifnot,connectthemup:5Vtopowerrail,DintoArduinopin6,GNDto
groundrail.
Thenaddamomentarypushbuttontoyourbreadboard,straddlingthecenterdividingline.Connectonelegtothe
groundrail,anditsneighboringlegtoArduinopin2.IntheAutodeskCircuitsmodule,clickthe"CodeEditor"button,
then"DownloadCode"andopenthefileinArduino,orcopyandpastethecodeintoanewblankArduinosketch.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 21/35
11/12/2016 Project:InfinityMirror
PluginyourUSBcableanduploadthecodetoyourArduinoboard.Pressthebuttonitshouldtriggeranew
animationtoplayacrosstheNeoPixels.The5Vrailissufficientforthisfewpixelsonlimitedbrightness,butforfuture
projectswithmoreLEDs,youwillneedaseparatepowersupply,asdiscussedintheskillslesson.
Code
Let'sexaminethecodeinmoredetail:
#defineBUTTON_PIN2//DigitalIOpinconnectedtothebutton.Thiswillbe
//drivenwithapullupresistorsotheswitchshould
//pullthepintogroundmomentarily.Onahigh>low
//transitionthebuttonpresslogicwillexecute.
#definePIXEL_PIN6//DigitalIOpinconnectedtotheNeoPixels.
#definePIXEL_COUNT19
#defineBRIGHTNESS100//0255
//Parameter1=numberofpixelsinstrip
//Parameter2=pinnumber(mostarevalid)
http://www.instructables.com/lesson/ProjectInfinityMirror/ 22/35
11/12/2016 Project:InfinityMirror
//Parameter3=pixeltypeflags,addtogetherasneeded:
//NEO_RGBPixelsarewiredforRGBbitstream
//NEO_GRBPixelsarewiredforGRBbitstream,correctifcolorsareswappedupontesting
//NEO_RGBWPixelsarewiredforRGBWbitstream
//NEO_KHZ400400KHzbitstream(e.g.FLORApixels)
//NEO_KHZ800800KHzbitstream(e.g.HighDensityLEDstrip),correctforneopixelstick
Adafruit_NeoPixelstrip=Adafruit_NeoPixel(PIXEL_COUNT,PIXEL_PIN,NEO_GRBW+NEO_KHZ800);
boololdState=HIGH;
intshowType=0;
SimilartotheNeoPixelexamplecode,thisfirstsectionsetsuptheNeoPixelstripandthevariablesforthe
pushbuttonpin,pixelcontrolpin,etc.
voidsetup(){
pinMode(BUTTON_PIN,INPUT_PULLUP);
strip.setBrightness(BRIGHTNESS);
strip.begin();
strip.show();//Initializeallpixelsto'off'
}
Thesetupfunctionsetspin2toaninputwithitsinternalpullupresistoractivated,setstheglobalbrightnessofthe
pixels,andstartsupthepixeldataconnection.
voidloop(){
//Getcurrentbuttonstate.
boolnewState=digitalRead(BUTTON_PIN);
//Checkifstatechangedfromhightolow(buttonpress).
if(newState==LOW&&oldState==HIGH){
//Shortdelaytodebouncebutton.
delay(20);
//Checkifbuttonisstilllowafterdebounce.
newState=digitalRead(BUTTON_PIN);
if(newState==LOW){
showType++;
if(showType>6)
showType=0;
startShow(showType);
}
}
//Setthelastbuttonstatetotheoldstate.
oldState=newState;
}
Theloopfunctionfirstchecksthecurrentstateofthebuttonandstoresitinabooleanvariable(canbeoneoftwo
states:HIGHorLOW).ThenitchecksanddoublecheckstoseeifthatstategoesfromHIGHtoLOW.Ifitdid,
showTypeisincreasedbyone,andthestartShowfunctioniscalled,withthecurrentshowTypepassedtoitasan
argument(showTypeisconstrainedto06).ThevariableoldStateisupdatedtoreflectwhatthelastbuttonstate
was.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 23/35
11/12/2016 Project:InfinityMirror
voidstartShow(inti){
switch(i){
case0:colorWipe(strip.Color(0,0,0),50);//Black/off
break;
case1:colorWipe(strip.Color(255,0,0),50);//Red
break;
case2:colorWipe(strip.Color(0,255,0),50);//Green
break;
case3:colorWipe(strip.Color(0,0,255),50);//Blue
break;
case4:pulseWhite(5);
break;
case5:rainbowFade2White(3,3,1);
break;
case6:fullWhite();
break;
}
}
ThestartShowfunctioncontainsaswitch/casestatement,whichisjustafancyfastwaytostackabunchofif/else
statements.Theswitchcasecomparesthevariableitothevaluesofeachcase,thenrunsthecodeinthat
statement.Thekeywordbreak;exitstheswitch/casestatement.Thisswitch/caseisusedtocalldifferentanimation
functionseverytimeyoupressthebutton.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 24/35
11/12/2016 Project:InfinityMirror
Nowthatyou'vegotafunctionalbreadboardprototype,it'stimetomakethisintoafinishedprojectbyusingan
ArduinoGemma,whichissmaller,lessfullyfeatured,andlowercostthantheArduinoUno.Youcanalsousean
AdafruitGemmainstead,butyouwillneedtoperformanadditionalsteptoconfiguretheArduinosoftware.
First,changetheNeoPixelpinvariablefrom6to1inyourcode:
#definePIXEL_PIN1//DigitalIOpinconnectedtotheNeoPixels.
PlugyourArduinoGemmaintoyourcomputerusingaUSBcable,andselect"ArduinoGemma"asyourboardtype
intheArduinoToolsmenu.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 25/35
11/12/2016 Project:InfinityMirror
ThelimitedfunctionsoftheATTiny85microcontrolleronboarddon'tsupportaserialportinthesamewayasthe
Uno,soyoudon'thavetoselectanythingfromthePortmenu.However,besuretoselect"ArduinoGemma"under
theProgrammermenuitem.
Theboardneedsalittlehelpknowingwhenyou'retryingtoprogramit,sopresstheresetbuttonontheboard,and
whiletheredLEDispulsing,presstheUploadbuttontoloadyoursketchontotheGemma.IfyourredLEDdoesnot
http://www.instructables.com/lesson/ProjectInfinityMirror/ 26/35
11/12/2016 Project:InfinityMirror
pulsewhenyoupresstheresetbutton,yourUSBcablemaybepoweronly,andshouldbeswappedoutforaUSB
cablethathaspoweranddataconnections.AnotherreasonyourLEDmaynotpulseisifyouareusingaUSB3port
(allnewerMacs),whichhastroublerecognizingtheGemmabootloader.UseaUSB2portonyourcomputerora
USBhubinbetweenyourcomputerandGemma.
SolderCircuit
TorunthecircuitwithyourGemma,we'llsolderthe
wiresdirectlytothepadsontheboard.Snipoffthe
breadboardconnectorandstrip,twist,andtintheleads
oftheNeoPixelstripwires.Solderwiresontodiagonal
leadsofapushbuttoninthesamemanner(youcan
usethebuttonfromthesolderinglesson).Twistand
soldertogetherthetwogroundwires.
Gemma'slargeholesmakeiteasytoassemblethis
circuitwithnoadditionalpartsjustthreadthetinned
wiresthroughtheholesandwraptheexcessaround
thesolderpad.Theconnectionsareasfollows:
NeoPixel5V>GemmaVout
NeoPixelDin>Gemma1~(digitalpin1)
NeoPixelGND>onesideofpushbutton>
GemmaGND
othersideofpushbutton>Gemma2(digitalpin
2)
Setupyourcircuitboardinathirdhandtoolandheat
uptheconnectionswithyoursolderingironbefore
applyingsomemoresoldertoengulfthepadandwire.
Afteralltheconnectionscool,trimawayexcesswire
withyourflushsnips.
HotglueyourGemmainplacewiththeUSBportfacing
theedgeofthecircle.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 27/35
11/12/2016 Project:InfinityMirror
http://www.instructables.com/lesson/ProjectInfinityMirror/ 28/35
11/12/2016 Project:InfinityMirror
Applythefront/topcoverandmanipulatetheedgetoseatthepiecestogethercleanly.Youmayhavetotrimyour
bottomcirclejustabittomakeitfit,andlikewisepulltheedgeopentoaccommodateitsmate.Gluethepushbutton
inplacewhereveryoulike.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 29/35
11/12/2016 Project:InfinityMirror
http://www.instructables.com/lesson/ProjectInfinityMirror/ 30/35
11/12/2016 Project:InfinityMirror
UseIt!
PluginaUSBcable,pressthepushbutton,andenjoy!Youcanswitchupthecolorsandanimationsbychangingthe
code.UseaUSBpoweradapterifyouwanttomountitonawall.Atthispointyoucanmakeanothersmall
foamcoreedgepiecetocloseuptheremaininggap,ifyouwish.Somesuggesteduses:hangitonyourwall,keepit
atyourdesk,giveittoafriend!
http://www.instructables.com/lesson/ProjectInfinityMirror/ 31/35
11/12/2016 Project:InfinityMirror
YoucaneasilyrunthisprojectwithaninternalbatteryinsteadofconnectingaUSBcable.Theorientationatwhich
yougluetheGemmawilldeterminetheaccesstothebatteryport,soyoumaywanttoreglueitatadifferentangle.
19RGBWpixelstimes80mamaxcurrentdraw(plus~10mafortheGemma)equals1530ma,whichmeanswe
technicallyneedabatterywithatleastthatmanymAh.Howeverthecodeforthemirrordoesn'tcomeclosetousing
allfourpixels'LEDsatfullbrightnesstogether,soinrealitythemaximumcurrentdrawisfarless.Ahealthybattery
compromiseisa1200mAhrechargeablelipolybattery.
http://www.instructables.com/lesson/ProjectInfinityMirror/ 32/35
11/12/2016 Project:InfinityMirror
HugecongratsoncompletingyourfirstArduinoproject!PleaseshareaphotoofyourinfinitymirrorintheClass
Projectmodulebelow.
PreviousNext
AskaQuestion
Giveyourquestionasdescriptiveatitleaspossiblesootherscaneasilyfindit.Max70characters.
QuestionBody:giveusmoredetailonyourquestion...
AddPhotosAskaQuestion
Amazingdoesitscale?Answered 1Answer
Askedbylearnerboy
Answer
What'sthebiggestthatthiscanbemade?Theprojectidealookssupercool!
ReplybybekathwiaBestAnswer
http://www.instructables.com/lesson/ProjectInfinityMirror/ 33/35
11/12/2016 Project:InfinityMirror
Reply
HaveyouseentheLEDsignsinTimesSquare?Oh,notthatbig?=DSayyouhavea5Apowersupply.
5A=5000mA,andeachRGBWpixeliscapableofdrawing80mA.5000/80=~62pixels,oraboutone
meterofthestripthat'susedintheproject(60pixels/m).FormoreinfoonpoweringNeoPixels,look
here:
https://learn.adafruit.com/adafruitneopixeluberg...
uploadingtogemma?Answered 2Answers
AskedbyReyce
Answer
Hi,
WhenItrytouploadtogemmaitgivesmethiserror:
avrdude:ser_open():can'topendevice"/dev/cu.BluetoothModem":Resourcebusy
Problemuploadingtoboard.Seehttp://www.arduino.cc/en/Guide/Troubleshooting#uploadforsuggestions.
anysuggestions?
Thanks,
Reyce
ReplybybekathwiaBestAnswer
Reply
DoesyourGemmapulsetheredLEDwhenyouplugitintoyourcomputer?Ifnot,whatkindof
computerareyouusing,anddoesithaveUSB3ports?NewerMacsrequireaUSBhubtoprogram
Gemma,sinceit'snotcompatiblewithUSB3ports.AlsodoublecheckyourProgrammerissetto
ArduinoGemma,undertheToolsmenu.
ReplybyReyce
Reply
Thanksforyourquickresponse.IforgottosettheprogrammertoArduinoGemma.
Plasticseethroughmirrororfilm?Answered 1Answer
http://www.instructables.com/lesson/ProjectInfinityMirror/ 34/35
11/12/2016 Project:InfinityMirror
AskedbyVincentD67
Answer
PlasticseethroughmirrorseemstobecomplicatedtofindbutonewaymirrorfilmisavailableinallDIYstore.
Woulditbepossibletouseanacrylictransparentsheet+filmstuckonit?
ReplybybekathwiaBestAnswer
Reply
Tryitandsee!Aslongasonesideismirroredandyoucanseethroughtheotherside,it'sallgood.
I'veneverworkedwiththefilmyoumentioned,andfounditeasytobuytheplasticseethroughmirror
onAmazon.
AdafruitGemmanotprogramming?Answered 1Answer
AskedbyDeanRogers
Answer
IhaveanAdafruitGemma,notanactualArduino,anditwon'tprogram.IselecttheGemmaastheboardand
astheprogrammer,presstheresetbutton,theredLEDflashes,butafterthesketchiscompileditsays
"avrdude:Error:CouldnotfindUSBtinydevice(0x2341/0xc9f)"
http://www.instructables.com/lesson/ProjectInfinityMirror/ 35/35
let's make Explore(/tag/typeid/) Publish(/about/create.jsp) You (/you/)
(/tag/typeid/categorycraft/channelknittingandcrocheting/) Yarn(/tag/typeid/categorycraft/channelknittingandcrocheting/)
ARDUINO CLASS (/class/Arduino-Class/): LESSON 7 | 15 MINUTES
(/gifts/) Gifts(/gifts/)
(/file/FY60NTJIV0ABH2U/)
You've made it to the end! This lesson is your graduation ceremony. Please cue up Pomp and Circumstance
(https://youtu.be/Kw-_Ew5bVxs) as the background music while you continue reading. What follows are some parting
words of advice for venturing off into the world of Arduino on your own.
LearningtoFish
Rest assured that because of its rich community history, most of your early questions about Arduino are already well
documented online in tutorials and forums all over the web. However you are just learning the vocabulary by which to
access this vast catalog of resources, and things may be a little rocky at rst. Remind yourself there is a learning curve, and
everything will get easier and come more naturally after some time and repeated practice. Here are some tips to improve
the results of your self-directed learning.
Google with gusto - Get good at search engines! Use quotes to search for Arduino error messages, brainstorm key words
around your idea and look for folks who've documented similar projects before. This can be handy during the parts
brainstorming step but also for learning more uses for the parts you already have. Become a regular lurker in the Arduino
(https://forum.arduino.cc/) and Adafruit (https://forums.adafruit.com/) forums, where most beginner roadblocks are
solved many times over. Say it with me: "I bet I can nd someone online who's had this question before; I just have to nd it."
Sharing (code) is caring - Arduino is built on open source ideas. Innovation ourishes when technology is shared! You'll
nd countless libraries, code examples, Github repositories, and more resources to aid in your coding education. It
behooves you to read up on the history of open source, learn about licenses commonly used for code and hardware, and
credit your sources when building on others' designs.
Document your process - It's easy to forget to photograph your circuit before revising it when you're in the throws of
frustration over a bug. Set a timer to remind yourself to take pictures and video while building! You may nd yourself
wanting to look back at previous iterations to avoid making the same mistakes twice. Additionally, you'll nd a supportive
community of makers willing to help you along your way if you choose to share your projects online in forums, your own
website, or here on Instructables. Documenting your struggles along with your successes will connect you with
knowledgeable folks around the globe, and maybe even help someone else who's just learning Arduino.
Durability&Weatherproofing
It's quite likely you want to create Arduino projects that will function for some time while enduring repeated movement or
exposure to the elements. Designing durability into a circuit requires some forethought of potential failure modes, often
only discovered through repeated prototyping and improvement upon prior failure. Here are some tips on design and
construction for durability. Remember to read and follow manufacturers' instructions and safety procedures when using
any hazardous materials.
Protect the power supply - The most important part of your circuit to keep safe is the battery and power connections. A
short circuit here could trip a circuit breaker, permanently damage components, or cause a re.
Strain relief - Remember that your circuit has both mechanical and electrical connections. Sometimes they are one in the
same, like the Arduino's USB and power ports. However it's always a great idea to add mechanical connections to your
projects to prevent wires from tugging on their solder joints. You can use zip ties to secure wires, and most circuit boards
have mounting holes for use with screws or hand sewing (http://www.instructables.com/class/Hand-Sewing-Class/). For
connections that will bend repeatedly, use stranded wire instead of solid-core.
Know your adhesives - Using the right glue for the job is critical for your circuit's durability! For instance, few things will
actually stick to the silicone sheathing that comes around LED strip. Only certain silicone adhesives will provide a
weatherproof seal in this case. Permatex 66B (http://www.amazon.com/dp/B0002UEPVI/?tag=instructabl09-20) is my
favorite for NeoPixel strip's silicone sheathing. Any adhesive should be tested to check that it bonds to both surfaces. Hot
melt glue was convenient for the in nity mirror project in this class, but it stinks for durability. Instead I highly recommend
E6000 craft adhesive (http://www.amazon.com/dp/B0018NBWVO/?tag=instructabl09-20), or its cousin Quick Hold.
These take longer to dry but stick to everything (except silicone) and dry clear and exible. To learn more about adhesives,
check out our Glue class (http://www.instructables.com/class/Glue-Class/)!
Humidity & moisture - It's important to protect your circuit from water, which will cause shorts. If you're thinking of
making an electronic costume, for instance, did you consider that your evaporating sweat could be a factor? Where will
your circuit be located and what humidity/water conditions can you expect there? Generally you can think of using
coverings and coatings to address this issue. You can nd completely waterproof enclosures for your projects, cover your
circuit with waterproof fabric, and use waterproof adhesives to seal up any openings. I often use clear nail polish to protect
bare components on costumes/wearables. Clear spray paint is also a good option, however I'm not a big fan of the new
hydrophobic coatings like NeverWet. They were designed for things like the circuit board inside your phone, and don't
function well outside that context because of their extreme physical fragility, sensitivity to sunlight, and highly toxic nature.
However water is not a circuit's nemesis! If the battery/power supply is removed, most circuits won't be damaged by
water, so long as they dry out before being plugged back in (and weren't left a long time to corrode). Exceptions exist for
components that water can get inside, like microphones. But generally, it's ok to hand wash your Arduino projects after
unplugging the power and removing any batteries.
UV and temperature uctuation exposure - Over time, many plastics, adhesives, and other protective materials break
down when exposed to sunlight. Wire sheathings may become brittle and crack open. Coatings may break down and fail.
Think about the temperatures your circuit is likely to experience, too. Most batteries' lives are shortened by exposure to
high or low temperatures, for instance. Check the datasheets for your components to learn their operating temperature
ranges.
This is just the tip of the durability iceberg, folks. There are whole elds of study devoted to the topic, in mechanical
engineering, industrial design, and materials science just to name a few. However for most projects, a bit of E6000 and
some zip ties really go a long way towards keeping your projects alive.
Next,Try...
(/file/F3YF70HIV0AL2UY/)
If you completed all the lessons in this class, you're now ready to take on countless Arduino projects, including your own
designs. You may nd many of the early code examples to be great starting points when building your own sketches. For
your next class, consider Electronics (http://www.instructables.com/class/Electronics-Class/), or Wearable Electronics
(http://www.instructables.com/class/Wearable-Electronics-Class/), or Robots
(http://www.instructables.com/class/Robots-Class/), which will all deepen your understanding of some of the concepts
from this class.
Here are some projects from the Instructables community to help inspire your next creation:
Word Clock (http://www.instructables.com/id/The-Word-Clock-Arduino-version/) by drj113
Have you made a project with Arduino you'd like to share? Please consider writing an Instructable about it, and enter it in
one of our frequent contests.
Thank you so much for taking my Arduino class! If you enjoyed your experience, consider sharing it with a friend. And I'd
like to receive your feedback either way, so I can improve this and future classes.
Previous(/lesson/ProjectInfinityMirror/)
AskaQuestion
Searchexistingquestions...
Giveyourquestionasdescriptiveatitleaspossiblesootherscaneasilyfindit.Max70characters.
QuestionTitle ?
QuestionBody:giveusmoredetailonyourquestion...
AddPhotos AskaQuestion
fabricationoffirefightingrobot?
Answered 1Answer
Askedbykartikk28(/member/kartikk28)
Answer
howtobuiltafirefightingrobotusingardiunouno
andalsocanyougiveitscoding....
Colorofinfinitymirror?
Answered 2Answers
Askedbyemrude(/member/emrude)
Answer
DoestheInfinitymirrorneedtobeblack?Justwonderingifblueorpurplewouldwork.
Thanks
Replybybekathwia(/member/bekathwia) BestAnswer
Reply
Makeitwithwhatevercolorfoamcoreyoulike!Oruseadifferentmaterialentirely!=D
Replybyemrude(/member/emrude)
Reply
Iwouldliketomakeasmallwallmapleormaybeturning.Iwillproblablyuseawallwart.Iwillpostapicturewhenit'sdone.Thanks,
fortheclass.