cs120 fall 2019 lab 9 – week of november 17th arduino time

Post on 08-May-2022

3 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

CS120Fall2019Lab9–WeekofNovember17thARDUINOTIME

JustalittlebitoffunwiththeArduino.It’sjustwiresandelectricity.Don’tletitfreakyouout!1)Open“file/examples/basics/blink”–thisisasmallsampleprogram.2)Clickthe“upload”button–thisisanarrowtotheright3)Ifeverythingissetupcorrectly,you’llseetheLEDsontheArduinoflickerforamoment,andthentherewillbeasingleLEDthatblinksonandoff.TheTAhasbreadboards,LEDs,wires,andresistors.

Onthebreadboard,thelongverticalstripesontheleftandright(withtheblueandred)areconnected–theyarenormallyusedforpowerandground.Inthemiddle,thelefthorizontalgroupoffiveholesareconnected,asaretheright.

AnLEDwilllightupwhenthelongerleghaspower(5volts),andtheshorterlegisconnectedtoground(abbreviatedGND).TokeeptheLEDfromusingtoomuchpower,connectthenegativepinoftheLEDtogroundusinga1kohmresistor(stripesarebrown/black/red).

TryconnectingupanLEDtopowerandgroundfromtheArduino–makesureitturnson.Then,connectittopin13ontheboard–itshouldblinkinthesamewayastheLEDembeddedontheArduino.Andnow…Moveittoconnecttopin12,andhavethemalternateonandoff….

AddsomemoreLEDs,usingotherpinsfromtheArduino.Canyoubouncethelightsbackandforth?Getthemtocount?

Onceyou’vegotthatgoing….Therearesomespeakers.CheckouttheToneMelodysketch.

top related