Post on 28-May-2018
TraintheTrainerResources HexFilesHere-https://goo.gl/mQoVRV
http://microbit.org https://makecode.microbit.org/
Inthistopicyouwillexploretherangeofmethodsofinputthatthemicro:bithas,andthecommandsusedtocodetheseinputs.
Usethereferenceguideandhelpfeaturehoweachcommandworks.
UsingButtons
Onbuttonpressedcommand–TheseLabelledAandB.Whenpressedtheycanbeusedtoexecutemicrobit.
Task
Createaprogramwhereeachbuttongeneratesadifferentimage.Pressingbothbuttonstogetherisathirdinputeventandinthiscasegeneratestwoimagesthatalternatecreatingasimpleanimation.
Whenaninputisuseditcanbetestedinthesimulator.Byclickingonthatinput.
Trycombiningdifferentbasiccommandstodisplaydifferentinformationwhenthebuttonsarepressed.e.g.anintelligentbadge,Showingdetailslikeage,namemoodetc
DebugandDownloadtothemicro:bit.
LearningObjectivesUnderstandthatthemicro:bittakesinput,andafterprocessingtheinput,producesoutput.Learnthevarietyofdifferenttypesofinformationthemicro:bittakesinasinput.Applythisknowledgebycreatingamicro:bitprogramthattakesinputandproducesanoutput
ComputingConceptsIdentifyandtheinputdevicesavailableonthemicrobitandtheirfunctionUseavarietyofmicrobitcommandstoprocesstheinformationreceivedasinputUseavarietyofmicrobitinputeventhandlercommandstocreate‘realworld’solutions
Topic3NeedInputandOutput
Writealistofinputsthatamicro:bithas.
TraintheTrainerResources HexFilesHere-https://goo.gl/mQoVRV
http://microbit.org https://makecode.microbit.org/
UsingOnShakecommand
Theaccelerometeronthemicro:bitwhichdetectschangesinthemicro:bit’smovement.TheOnshakecommandallowstheuseofthisinformation.
Task
Makingasimpledicerequirestheuseofavariable.
TocreateaVariableaccessthistutorial-https://makecode.microbit.org/blocks/variables
Youcodeshouldlooklikethis.
Testinthesimulatortousethesakefeature.Thendownloadtothemicro:bit
UsingOnPincommand-Asinputs,themicrobitPinsareabletodetectchangesincurrent.ThisisspreadbetweenthePinseither0,1,2andPinGND.Themicro:bitisabletodetectthechangeincurrentacrossthePinseventheextremelysmallamountyourbodycauseswhenthepinistouched.InthisexamplewhenPin0istouchedthemicrobitgeneratesanddisplaysarandomnumberbetween0and100.Task
CompletetheLoveMeterProjectTutorial–foundintheprojectsfolder.Thisisatutorial,followtheonscreendirections
TraintheTrainerResources HexFilesHere-https://goo.gl/mQoVRV
http://microbit.org https://makecode.microbit.org/
UsingtheLightlevelcommand.Thelightlevelcommandrequiresanothercommandtodosomethingwithit.e.g.shownumberorassignedtoavariable.
NoticethatwhenyouusetheLightlevelcommandthesimulatorasmallhalffilledcircleappears,byclickanddraggingtheborderbetweenthelightanddark,youcanvarytheamountofvirtuallight.thevaluenexttoitwilldisplayonthemicrobit.0equalsdarkand254equalsfulllightByassigningthelightlevelcommandtostoreitsvalueinavariableyoucangetmorecontrolofwhenandwherethereadingsaretaken.
TaskUsingthebuttonandavariableitispossibletomakeasimplelightmeterrecorder
UsingtheTemperaturecommand-ThisworksinasimilarwaytotheLightcommand.Itiseasierandmoreproductivetoassignthetemperaturevaluetoavariable.
TaskCreateaprogramthatautomaticallyconvertsthetemperaturereadingtofromcentigradetoFahrenheit.
Whereinyourschoolcurriculumcouldthesefeaturesbeusedandextended?
TraintheTrainerResources HexFilesHere-https://goo.gl/mQoVRV
http://microbit.org https://makecode.microbit.org/
Usingthemagnetometertocreateacompass.Likeananaloguecompassthesensordetecttheearth’smagneticfielditreturnavaluethatiscompassheading.Tomakesurethesensorworks
well.Itisadvisabletoaddacalibrationfunctiontothecode.ThiscanbedonebyassigningthecalibratecompassfunctiontoapressofbothA+B.
Againavariablehasbeenusedtoassignthecompassheadingandagainthemicrobitsimulatorwillshowavirtualheadingdialwhichcanbeusedtotestyourcode.TaskBuildamoreusefulcompassthatconvertstheheadingvalueintoadirection.Detailsforbuildingthiscompasscanbehere–https://makecode.microbit.org/lessons/compass
UsingtheaccelerationcommandThereisanaccelerometeronthemicro:bitwhichdetectschangesinthemicro:bit’smovement.It convertsanalogueinformationintoadigitalformthatcanbeusedinmicro:bitprograms.Outputisinmilli-g.Thedevicewillalsodetectasmallnumberofstandardactionse.g.shake,tiltandfree-fall.TaskExplorethereferencedocumentationherehttps://makecode.microbit.org/reference/input/accelerationUsethesebuttonstoseethecodeinactionFindoutwhattheydo.
Createthiscodeanddownloadittoamicro:bit.Carefully‘swing’themicro:bit.Whathappens?
TraintheTrainerResources HexFilesHere-https://goo.gl/mQoVRV
http://microbit.org https://makecode.microbit.org/
TrainerReflection
MakerActivitieshttps://make.techwillsaveus.com/bbc-microbit/activities/electro-fishinghttps://make.techwillsaveus.com/bbc-microbit/activities/shooting-hoopshttp://microbitgadgets.co.uk/microbit-projects/microbit-games/bbc-microbit-steady-hand-gameTablefootball-https://youtu.be/zqnDAzaKnvA
SmileyButton-https://makecode.microbit.org/projects/smiley-buttonsLovemeter-https://makecode.microbit.org/lessons/love-meter/activitySimpleThermometer-https://makecode.microbit.org/reference/input/temperature Compass-https://makecode.microbit.org/lessons/compass GlowingPedulum-https://makecode.microbit.org/lessons/glowing-pendulum
Topic3NeedInputandOutput
Whathaveyoulearntinthistopic?
Whatelsedoyouthinkyouneedtoknowaboutthistopicandhowwillyoufindthisout?
Howmightyouintroducethistopictootherteachers?
Whatareasofthistopicmightbedifficulttoteachorunderstandforotherteachers?