Oneofthethingsthatwehavetodowiththissystemiswhenwegoto a normalWebpagethatwentpageon.
Leerefresheswhenwetellittorefresh.
Sothat's a problemthatyoucangetintowhenyou'reusing a Webpageinordertolookatreadingscominginfrom a sensorisitonlyrefresheswhenyoutellittorefresh, soyouknowyoufirstturniton.
I willremindyouwhenyou'reusingsomethingliketheWiFiboardon, especiallywhenyou'regonnabeaccessingitthrough a I P addressorsuch, youdonothavetohavethisconnectedtothecomputer.
Onceeverythingissetupagain, youcanplugin a littleUSBpowersupplylikethis, youcanplugin a poweradapter, whatever.
Thiscouldbe 100% separatedfrom a computerandcontinuedoingwhateveritisyou'vetoldittodo.
Sowiththat, let's goovertothecomputerand I canshowyouthecodehowtobuildthisthing.
Sohere's thesketchforthisparticularproject.
Nowit's goingtostarttoseehim a littlebitmorecomplicatedthanothersketchesthatwe'vedoneinthepast.
Sothisisonethingwhere a lotofpeopleaskme, Eli, what's thebestprogramminglanguage I shouldlearn?
Whatprogramminglanguageshould I learnasifit's anindividualthingonwhatyoufindintherealworldismanytimesyou'regoingtobeusingmultiplelanguageseventodosomethingrelativelysimple.
Literally.
Allwe'regoingtobedoingisshowing, youknow, thatthenumber, thenumberforthetemperaturereadingand a changingthecolorandsizeofit, andtodothat.
So I havecreatedthesevariables, and I'vesetthesevariablesheretomakelifeeasierifweneedtomodifyitsowecanIf I needtomodifythesenumbersinthefuture, I cansimplycomebacktothisoneplaceandmodifythenumberversushavingtogothroughhereandchangeitmultipletimes.
Youwillmessitupso I couldjustsimplywritethecodedownhere I cansecuresimplysaytemperature F isgreaterorequaltohightemp, andsothat's thevalueofthatvariable.
Now, insteadofhavingtogothroughandmodifythenumberfiveorsixtimes, I cansimplymodifythatoneplaceupherewiththesetwovariablesthenwe'regonnadoiswe'regonnacomedownhereandwe'regoingtosetuptheenvironmenttothefirstthingthatwe'regonnadoiscerealdotagain 9600.
Sowhilestatusdoesnotequal W l connectedserial, it's gonnaprintouttotheserialmonitorattemptingtoconnecttonetworknamedandthenit's goingtogivethenametest.
Thenthestatusequalsandwe'reusingthefunctionWiFinotbegin s s I.
D onpass.
Soit's gottafeedthe s s I d andthepasswordofdysfunction, andit's goingtotrytoconnecttotheWiFinetwork, thinkwhendelayfor 10,000 millisecondsor 10 seconds.
Thenit'llserialaboutprint S s i d with E s s i d is.
Andthenthisishowyougetthe i.
P.
Addressandprintedout.
Soprintoutthe s s I d andprintoutthe I P.
Addressagain.
Thisisthekindofthingyouneedonthesetypesofprojectsbecauseyouneedtoknowwhatthehell d I p addresses.
Youcancodeallthisperfectly, butyoudon't knowwherethe I P addresses.
Thenit's gonnabeimpossibletoaccess.
Andthat's nowtheenvironmentthat's setupnowwe'regonnagointo a loop.
Thefirstpartofloop.
Thisishowweareabletoobtainthetemperatures.
Sowedoneanalogtemperaturesensors 1000 times.
Atthispoint, I'm notgonnagointothis, Butbasicallytheimportantthingtounderstandhereisthisishowwegetthevalueforeithertemperature, see, temperatureCelsius, orthisishowwegetthevaluefortemperature f temperatureFahrenheit.
SowhenyourWebbrowsercannexttotheyard, weknowit's goingtoprintoutthatinformationontheserialmonitorandthenwhenitgetsto a newline, Soif C equalsnewlineandbasically, ifcurrentlinedotlengthequalzero, thenwestartactuallysendingstufftotheclienttotheWebbrowseron.
Sothefirstthingthatwehavetodoherebeforewegettothe F elseifelsestatementiswe'regoingtoactuallyprintoutsomemadeofdataonwhatthisisforistohavethewebpageautorefreshitselfagain.
Oneofthingshavetobethinkingaboutwhenyoudisplayinformationishowoftenisthatinformationgoing t berefreshed.
Andsoagain, especiallyforsomethinglike a temperaturesensoror a temperaturealertsystemyouanythingabouthowoftenyou'regoingtorefreshanddoyouwant a manuallyrefresher?
Youwanttohaveitbeautomaticallyrefreshedforthis, sinceallwe'redoingisliterallyweresimplyprintingout a numberin a prettycolor.
Andsowhatwillhappenisthenwhatwillbeprintedoutisthebackslasheswillberippedoutandyou'lljustget a nice, solidpieceofCSSorHTMLorwhateverhere.
Sothat's a bigthingwiththebackslashisanytimeyougetto a problemlikeyou'rewritingsomethingandyoustarttoseeblacklikethis, youknowyou'rerunningintoanissuewheretheArduinothinksthatit's itsfinishedinterpretingwhatit's supposedtointerpret, andyouput a backslashinthereandmakesureeverythingisinbluethat's supposedtobloom.
Thenwe'regoingto a client, notprintorsimplydothevalueoftemperature, F whateverthatistherealready a client, notprintlineandclosedthe H onetax.
WhatisgonnadioisthiswillprintoutwhatevertemperatureisinFahrenheitinbigandred, thenelseifelseifelseIftemperatureFahrenheittemperature F islessthanhightemp, lessthan 82 temperature F isgreaterorequaltogood.
Thedifferencebeingisthecolorisgoingtobegreennow, then a SZFarastheWiFithingisconcerned, we'regoinghavetobreakandthenwe'regoinghavebasicallyallofthishere, whichagainisbasicallycopyandpaste.
Thisiswhat's requiredinorder.
HavetheArduinotounderstandhowthewife I communicationissupposedtohappen.
10 6 10 secondsWhileyou'retryingtoteach a classseemslikeforeverButthey'reagoWegottaconnectedSoit's nowconnected S s I d It's connectedThiothethetestWiFinetworkandthisisits i p address.
Sowecansimplycopythatifwewant, wecangoovertoGoogleChromeopenupGoogleChromedualcontrol V enerAndtherewego.
Sowhatwecanseehereisthatwe'vecreated a very a largenumber.
Soagain, thisissomethingthatyoucouldusein a verystandardWebbrowser.
Imagineyou.
Youknowyouhaveraspberrypilayingaroundorsomethinglikethat, andyouwanttobeabletohavesomekindofdisplayfordifferenttempehcuresfordifferentplacesagain, somethinglike a serverroom.
Sothisshowsyouhowyoucanhavethisareweknow, youknow, WiFisittingin a serverroom.
It's connectedtoyourWiFinetwork, andthenyoucanhave a displaylikethisupanywherethat's connectedtwotothenetworkthatcanconnecttoittothe I P address, anditwillsimplyrefreshandshowyouwhatthetemperatureisandwillalertyouifthetemperaturegetstowaragain.
Likeyoujustsaidithereat 72.96 degreesandautorefreshesOh, no, it's 83 degrees.
Getthe O.
Sothatwasanother a littleprojectusingArewe?
No, noWiFiAnd, ofcourse, ourtrustylittleanalogtemperaturesensor.
I likeusingtheanalogtemperaturesensorbecauseitgivesyoutheabilitytochangethevaluesratherdynamicallyandhaveyourcodewiththosethoseifelseifelsestatements, youknow, beabletotrigger a differenteventstohappen.
What I reallywantyoutobethinkingaboutnowwiththese I o T projectsisyourinputcouldbe 1000 differenttimesofsensors, andyouroutputcouldbe a lotofdifferentthingsagain.
Youjustneed a littlereadyled, likegoingoff.
Youwant a buzzergoingoff?
Doyouwant a bigolddisplaywith a numberthattellsyousomethingspecific?
It's notjustsimplyit's notjustsimplytexton a screenor a pictureorsomethinglikethat.
Youreallyhavetobethinkingaboutwhat?
Okay, thereis a problemthesensorhasdetected.
Somethingiseithergoodorbad.
Now, nowwhat?
Whatdoyouwanttohavehappenagain?
BrokeouttoanLCDscreen.
Youwant a buzzer?
Youwantsomethingon a webpage?
Doyouwantsomethingtobedocumentedinto a databaseorprintedtoe?
A file?
Allofthesethingsarepossibilitieswithoutputs.
Andalloftheseareveryrelevantinthis I t world.
Sothat's whythat's why I thinkthiskindofstuffisnifty.
Meandagain, don't gettoohyperfocusedwhen I showyouananalogsensororsomething.
A lotofpeoplegethyperfocusedon, and I'm tryingtoshowyoutheoverallconcept.
Youtakethis, youcopyandpasteandfigureoutwhatyouwantto d'ohwhentheotherimportantthingstobethinkingaboutwith a smalllittleprojectnoisinthisprojectwheresimplywereessentiallyusingthreelanguages.
Somanypeople, whentheythinkaboutprogramminglanguages, theysay, Whatwhatlanguageshould I learn?
Whatlanguageandwhat I wanttoshowyouherewheneventhisexceptionally, exceptionallysimpleprojectwe'reusingArduino, whichis a derivative c c++ wheredousingCSSandwe'reusinghtml.