Rydym wedi addasu'r deunydd a gafodd ei greu ar gyfer ein Clwb Roboteg fel bod pawb yn gallu ei ddefnyddio gartref neu yn yr ysgol.
Mae pob un o'r sesiynau isod yn cynnwys gwers fideo gan aelod o'n staff a set o ymarferion i asesu eich dealltwriaeth. Gan fod y dudalen hon ar gyfer dysgwyr annibynnol, mae'r atebion wedi'u cynnwys.
Ar gyfer athrawon ac arweinwyr grwpiau, cyn bo hir rydym yn gobeithio creu pecynnau o'r adnoddau hyn a fydd ar gael yn rhad ac am ddim yn ein Siop TES i'w defnyddio gan ysgolion a chlybiau STEM.
Dewiswch bennawd sesiwn i gychwyn.
Gwers Fideo (yn Saesneg):
Ymarferion:
Rydym wedi creu her ar dair lefel (efydd, arian ac aur) er mwyn i ddysgwyr ddechrau ymchwilio a chreu rhaglenni yn Microsoft Makecode.
Dylai pob dysgwr ymgymryd â'r her efydd i gychwyn cyn rhoi cynnig ar yr heriau uwch.
Cliciwch ar bennawd pob her i gael y manylion.
Creu rhaglen (yn Makecode) sy'n gwneud y canlynol:
Pan fydd y rhaglen yn dechrau, rhaid sicrhau bod y LEDs yn dangos delwedd o'ch dewis.
Gair o gyngor: I ddileu blociau, pwyswch y botwm dileu ar eich bysellfwrdd neu llusgwch y blociau yn ôl i'r ddewislen.
Gallwch ddefnyddio delwedd sy'n bodoli eisoes gyda'r bloc 'dangos eicon' neu greu eich delwedd eich hun gan ddefnyddio'r bloc 'dangos leds'.
Os ydych chi'n defnyddio'r bloc 'dangos leds', gallwch glicio ar y sgwariau i ddewis a ydyn nhw'n cael eu goleuo ai peidio.
Byddwch ond eisiau gweld y nodwedd hon pan fydd y rhaglen yn dechrau, felly dylech ei rhoi yn y bloc 'ar ddechrau'.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Defnyddiwch y bloc 'dangos leds':
Defnyddiwch y bloc 'show eicon':
Ar ôl cwblhau'r cam cychwyn, dylech ddefnyddio'ch rhaglen i chwarae animeiddiad drosodd a throsodd nes eich bod yn stopio'r rhaglen.
Gair o gyngor: Cyfres o ddelweddau yw animeiddiad sy'n gwneud i wrthrych edrych fel petai'n symud.
Bydd angen i chi ddefnyddio'r bloc 'am byth' i wneud hyn.
Gellid defnyddio dwy ddelwedd yn unig i greu animeiddiad syml.
Er enghraifft, gallwch ddefnyddio'r bloc 'dangos eicon' ar gyfer y galon fawr ac yna'r galon fach. Bydd hyn yn creu animeiddiad sy'n edrych fel calon yn curo.
Does dim angen saib ar gyfer cyfres o ddelweddau sy'n gwneud animeiddiad oni bai eich bod am arafu'r lluniau.
Gallwch ddefnyddio 'dangos leds', 'dangos eicon', neu gyfuniad o'r ddau.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Mae hyn yn dangos nad oes angen i chi ddefnyddio llawer o LEDs i greu animeiddiad.
Gofalwch fod delwedd wahanol yn ymddangos ar eich Micro:Bit wrth bwyso botwm A.
Gair o gyngor: Mae botwm A yn fewnbwn, felly chwiliwch am y ddewislen sydd â'r bloc sydd ei angen arnoch.
Gair o gyngor: I brofi'r rhaglen, dydy'r botwm A ddim yn cyfateb i'r botwm A ar eich bysellfwrdd. Mae'n cyfeirio at y botwm A ar Micro:Bit y tu mewn i'r efelychydd, a gallwch glicio arno gyda'ch llygoden.
Mae'r bloc y bydd ei angen arnoch ar gael yn y ddewislen bloc Mewnbwn.
Dydy'r bloc hwn ddim yn mynd y tu mewn i'r blociau 'ar ddechrau' neu 'am byth'. Yn hytrach, mae'n dechrau adran newydd o flociau cod.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Ychwanegwch sain neu gerddoriaeth at eich dilyniant cychwyn.
Gair o gyngor: Dylech sicrhau bod lefel sŵn eich cyfrifiadur yn isel cyn ychwanegu sain. Gallwch addasu'r sŵn yn ystod y prawf i lefel o'ch dewis.
Gair o gyngor: Os ydych chi'n defnyddio cerddoriaeth, dylech gadw'r alaw yn fyr a'i chwarae unwaith yn unig, neu bydd rhaid i chi aros am amser hir nes bod yr alaw wedi gorffen yn ystod pob prawf.
Gair o gyngor: Os nad ydych am greu eich alaw eich hun, sgroliwch i lawr y ddewislen Cerddoriaeth i ddod o hyd i alawon a synau parod.
Os ydych chi'n defnyddio'r bloc 'play melody' ar frig y ddewislen Cerddoriaeth, gallwch greu eich alaw eich hun trwy glicio ar y symbol nodyn cerddorol yn y bloc, yna uwcholeuo'r bocsys i greu nodau gwahanol.
Os ydych chi'n defnyddio'r bloc 'play melody' gydag alawon sydd wedi'u rhagosod, dylech newid yr opsiwn 'in background' i 'until done' gan ddefnyddio'r saeth i lawr.
Os ydych yn dal i gael trafferth, defnyddiwch y botwm ateb isod.
Defnyddio eich alaw eich hun:
Defnyddio alaw sydd wedi'i rhagosod:
Defnyddio effaith sain:
Gofalwch fod y Micro:Bit yn ymateb pan fydd yn clywed sain uchel.
Gair o gyngor: Dangosodd y fideo fod y meicroffon yn gweithredu fel synhwyrydd sain a'i fod yn ddyfais fewnbynnu.
Gair o gyngor: Gallech ddefnyddio delwedd, testun, cerddoriaeth neu sain fel ymateb.
Gair o gyngor: Sain uchel yn y rhaglen hon yw unrhyw beth dros 170.
Mae'r bloc sydd ei angen arnoch ar gael yn y ddewislen blociau Mewnbwn.
Edrychwch o dan micro:bit (V2). Mae'r bloc yn yr adran hon oherwydd bod dau fersiwn o BBC Micro:Bit ar gael erbyn hyn a dim ond fersiwn 2 sydd â meicroffon.
Bydd angen i chi wylio'r fideo eto os ydych chi'n ansicr sut i greu sain uchel yn yr efelychydd.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Mae'r datrysiad hwn yn sicrhau bod y Micro:Bit yn dangos neges pan fydd yn clywed sain uchel.
Defnyddiwch yr un rhaglen i greu'r canlynol:
Ar ddiwedd eich dilyniant cychwyn, cliriwch y sgrin ac ychwanegwch neges groeso.
Gair o gyngor: Defnyddiwch neges fer oherwydd bydd angen i chi aros iddi gwblhau bob tro y byddwch yn profi'ch rhaglen.
Gair o gyngor: Mae'r ddau floc sydd eu hangen i wneud hyn ar gael yn y ddewislen Sylfaenol.
Ym maes rhaglennu, rydym yn defnyddio'r gair llinyn i ddisgrifio unrhyw gyfres o symbolau.
Bydd angen i chi ddod o hyd i'r bloc 'dangos testun' cyn gallu newid y gair "helo" i air/neges o'ch dewis.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Ychwanegwch neges i'ch dolen 'am byth' sy'n dweud 'Angen Mewnbwn'.
Gair o gyngor: Dylech drin y sgrin hon fel sgrin aros.
Byddwch yn defnyddio'r un bloc ag a ddefnyddiwyd gennym ar gyfer y neges groeso uchod.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Sicrhewch fod y Micro:Bit yn arddangos delweddau gwahanol pan fydd y botwm B yn cael ei bwyso a phan fydd y ddau fotwm yn cael eu pwyso.
Gair o gyngor: Mae gan y bloc 'ar fotwm A wedi'i wasgu' saeth i lawr sy'n eich galluogi i newid yr A i B neu A+B.
Cofiwch fod modd dod o hyd i'r blociau botwm yn y ddewislen Mewnbwn.
Bydd angen tri o'r blociau hyn arnoch yn eich rhaglen, un ar gyfer pob cyfuniad o fotymau.
I brofi hyn, dylai'r efelychydd fod â botwm newydd sydd wedi'i labelu A+B, sy'n gadael i chi ddynwared effaith pwyso'r ddau fotwm gan ddefnyddio'r llygoden.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Ychwanegwch effeithiau sain gwahanol gan ddibynnu ar ba fotwm sy'n cael ei bwyso.
Gair o gyngor: Mae'n bosibl y byddwch yn dechrau gweld rhai mathau o ymddygiad digroeso yn eich profion wrth i ni ychwanegu mwy o flociau at y rhaglenni botwm. Byddwn yn rhoi sylw i pam mae hyn yn digwydd a sut i osgoi hyn yn nes ymlaen yn y gyfres.
Os nad ydych chi'n ansicr, gweler cam 4 yn yr her efydd.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Ychwanegwch adwaith ar gyfer pan fydd y Micro:Bit yn canfod ei bod yn dawel.
Gair o gyngor: Mae llawer o flociau yn cynnwys cwymplenni sy'n eich galluogi i newid geiriau allweddol.
Gair o gyngor: Ar gyfer y Micro:Bit, ystyr tawel yw unrhyw lefel sŵn o dan 90.
Cofiwch fod canfod sain yn fewnbwn.
Mae modd newid y bloc 'ar sain uchel'.
Gallai adwaith fod yn sain, yn ddelwedd, yn eicon neu'n neges.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Parhau i greu eich rhaglen trwy ychwanegu'r canlynol:
Newid y ddelwedd sy'n ymddangos wrth gychwyn gydag animeiddiad.
Gair o gyngor: Gallech ddefnyddio delweddau ailadroddus, neu efallai y byddwch am ddefnyddio bloc o'r ddewislen Dolennau i helpu gyda hyn.
Mae yna floc 'ailadrodd 4 o weithiau' yn y ddewislen Dolennau a gellir ei osod i ailadrodd faint fynnwch chi o weithiau. Mae hyn yn golygu mai dim ond unwaith y bydd angen i chi ddefnyddio pob delwedd.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Mae animeiddiad cychwyn y rhaglen hon yn dangos calon yn curo.
Newidiwch eich animeiddiad dolen am byth i ddangos person neu anifail yn symud i'r sgrin.
Gair o gyngor: Ewch ati i ddewis neu greu delwedd lawn o'ch person/anifail yn gyntaf. Yna bydd hi'n haws i chi greu'r animeiddiad.
Gofalwch fod eich anifail/person yn ymddangos o ochr chwith eich sgrin gan ddefnyddio un golofn o oleuadau ar y tro cyn ei symud yr holl ffordd ar draws y sgrin.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Newidiwch adwaith y Micro:Bit drwy ogwyddo i'r chwith a gogwyddo i'r dde.
Gair o gyngor: Mae gan rai blociau gwymplenni i newid gair allweddol.
Gair o gyngor: Mae'r Micro:Bit yn defnyddio ei fesurydd cyflymu ar gyfer hyn, sy'n synhwyrydd symudiadau. Ai allbwn neu fewnbwn yw hwn?
Bydd angen i chi ddefnyddio bloc o'r ddewislen Mewnbwn.
Oes bloc sy'n seiliedig ar symud y gallwch chi ei ddefnyddio? Pa opsiynau sydd ganddo ar gyfer y gair allweddol?
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Ychwanegwch effeithiau sain at y gogwydd i'r chwith a'r dde.
Mae'r un broses ar waith â phan wnaethom ni ychwanegu effeithiau sain at fewnbynnau'r botwm.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Ar ddiwedd eich dolen am byth, ewch ati i ddisodli'r bloc 'dangos testun Need Input' â bloc sgrin glir ac yna dangoswch lefel y sain yn lle hynny.
Gair o gyngor: Mae lefel y sain ar Micro:Bit yn cael ei mesur ar ffurf rhif.
Gair o gyngor: Bydd angen i chi uno dau floc gyda'i gilydd i greu'r cyfarwyddyd hwn.
Mae'r ddewislen Sylfaenol yn cynnwys bloc 'dangos rhif'.
Mae'r synhwyrydd sain yn ddyfais fewnbynnu, felly bydd angen i chi edrych yn y ddewislen Mewnbwn ar gyfer y bloc a fydd yn mynd i mewn i'ch bloc 'dangos rhif'.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Gwers Fideo (yn Saesneg):
Ymarferion:
Ar gyfer y sesiwn hon byddwn yn creu rhaglen i droi eich BBC Micro:Bit yn anifail anwes rhithwir.
Fel sy'n wir am bob un o'n hymarferion, mae dysgwyr yn cwblhau un lefel cyn symud i'r nesaf. Fel arall, mae'n bosibl y bydd dysgwyr yn methu derbyn gwybodaeth neu'n gadael allan cam hanfodol sy'n atal y rhaglen rhag gweithio.
Cliciwch ar bennawd pob her i gael y manylion.
Dechreuwch raglen Micro:Bit newydd ar Makecode gan gwblhau'r camau canlynol.
Ewch ati i greu neges a/neu ddelwedd sy'n ymddangos ar ôl pwyso dechrau er mwyn helpu i nodi'r rhaglen.
Gair o gyngor: Cofiwch fod modd defnyddio'r bloc clirio'r sgrin i greu toriad rhwng delwedd a neges.
Ewch ati i greu animeiddiad bach o'ch anifail anwes yn aros y tu mewn i'r ddolen am byth.
Gair o gyngor: Efallai y gallwch ddefnyddio animeiddiad y gwnaethoch chi ei greu yn Sesiwn Un.
Cofiwch, dim ond dwy ddelwedd sydd eu hangen arnoch i wneud animeiddiad.
Gallwch ddefnyddio'r eiconau sydd wedi'u creu ymlaen llaw i'ch rhoi ar ben ffordd.
Po fwyaf o ddelweddau rydych chi'n eu defnyddio, y mwyaf o amser y bydd ei angen i gwblhau'r ddolen am byth - gallai hyn achosi problemau wrth i ni greu'r rhaglen.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Defnyddiwch un o'r mewnbynnau (fel botwm A) i fwydo'ch anifail anwes ac ewch ati i'w ddefnyddio i ddangos delwedd o eitem fwyd ar y sgrin.
Efallai y bydd angen i chi glirio'r sgrin cyn dangos eich delwedd bwyd.
Cofiwch fod bloc rheoli botwm A wedi'i leoli yn y ddewislen Mewnbwn.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Mae'r ateb hwn yn cynnwys fy ymgais i dynnu llun o fyrgyr ar gyfer fy anifail anwes.
Ewch ati i greu animeiddiad sy'n dangos yr anifail anwes yn bwyta.
Pwysig: Mae'n bosibl y byddwch yn dechrau gweld rhai mathau o ymddygiad digroeso wrth i'ch animeiddiadau wrthdaro. Trwy ddefnyddio ein blociau os datganiad newydd, gallwn gywiro'r broblem a storio'r rhaglen gyfan y tu mewn i un ddolen am byth. Mae'r ddelwedd isod yn dangos sut i gynnwys botwm A fel amod mewn os datganiad y tu mewn i'r ddolen am byth.
Nodwch: Hira'n byd fydd eich dolen am byth, mwya'n byd y bydd hi'n ei gymryd i'r rhaglen ymateb i fewnbwn. Mae'n bosibl y bydd angen i chi ddal y mewnbynnau am fwy o amser er mwyn eu cofnodi.
Cofiwch: Dim ond un ddolen am byth y dylech ei chael yn eich rhaglen.
Gair o gyngor: Defnyddiwch yr adran arall yn y bloc os datganiad hwn fel cartref newydd i'ch anifail anwes sy'n aros am animeiddiad.
Gallwch animeiddio'r anifail anwes neu'r bwyd ar gyfer yr effaith hon.
Bydd bloc ailadrodd o'r ddewislen Dolennau yn helpu gyda'r animeiddiad.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Ewch ati i greu ymateb gwael gan eich anifail anwes (gallwch ddefnyddio delwedd, animeiddio, a/neu sain) pan fydd yn clywed sŵn uchel.
Gair o gyngor: Yn hytrach na defnyddio'r bloc 'ar sain uchel', defnyddiwch os datganiad arall y tu mewn i'ch dolen am byth ar gyfer lefel sain > 175.
Gallwch ehangu os datganiad trwy glicio ar yr arwydd plws. Gallwch wneud hyn ar gyfer cynifer o os datganiadau eraill ag y dymunwch.
Gallwch ddod o hyd i'r bloc mwy na yn y ddewislen Rhesymeg.
Er mwyn profi eich rhaglen, defnyddiwch y bar newydd ar gyfer lefel sain y meicroffon yn eich Micro:Bit wedi'i efelychu er mwyn newid y lefel. Pan fyddwch yn mynd dros 175 dylech weld y rhaglen - efallai y bydd ychydig o oedi.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Gan barhau â'r un rhaglen, ewch ati i gynnwys yr ychwanegiadau isod.
Defnyddiwch y rhaglen i drefnu bod eich anifail anwes yn mynd i gysgu pan fydd hi'n tywyllu (defnyddiwch lai na 70 neu'n hafal i 70 ar gyfer y gwerth hwn).
Gair o gyngor: Gallwch gael cynifer o os datganiadau ag y dymunwch mewn rhaglen Micro:Bit.
Defnyddiwch y botwm plws ar waelod eich os datganiad i ychwanegu arall os datganiad at eich rhaglen.
Gwiriwch pa symbol rydych chi'n ei ddefnyddio ar gyfer y gymhariaeth. Dylai edrych fel hyn ≤.
Gallech ddefnyddio testun o 'zzz' i ddangos bod eich anifail anwes wedi mynd i gysgu.
Cofiwch glirio'r sgrin yn gyntaf.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Ewch ati i greu newidyn ar gyfer 'llawnder' sy'n cynyddu fesul un bob tro y caiff eich anifail anwes ei fwydo.
Gair o gyngor: Mae gosod newidyn newydd i sero wrth ddechrau yn arfer da bob tro.
Mae yna newidyn newid fesul bloc sy'n gwneud yr hyn sydd ei angen arnom.
Pa ran o'r cod y mae angen iddo fynd i mewn iddi?
Dylech sicrhau nad ydych chi'n ei osod y tu mewn i ddolen ailadrodd animeiddiad.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Defnyddiwch fewnbwn (botwm B efallai) a fydd yn dangos gwerth 'llawnder' i'r defnyddiwr.
Gallwch roi newidyn y tu mewn i floc 'dangos testun'
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Defnyddiwch y rhaglen i wneud i'ch anifail anwes ymateb yn hapus i olau llachar (defnyddiwch fwy na 200 ar gyfer y gwerth hwn).
Os ydych chi wedi dewis gwneud animeiddiad, cofiwch am y bloc ailadrodd yn y ddewislen Dolennau.
Cofiwch sicrhau mai > yw eich symbol cymharu.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Fe wnes i ddewis i'm nadredd ddathlu golau llachar gydag animeiddiad trosbennu.
Defnyddiwch y rhaglen i wneud i'ch anifail anwes wneud sŵn i gael sylw os yw'r lefel sŵn yn llai na neu'n hafal i 50.
Gair o gyngor: Gosodwch floc saib (o leiaf 500 milieiliad) ar ôl i'ch sŵn chwarae - coeliwch fi.
Cofiwch sicrhau bod pa bynnag sŵn rydych chi wedi dewis ei ddefnyddio yn y rhaglen yn chwarae unwaith yn unig neu hyd nes ei fod wedi gorffen.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Nawr, gadewch i ni ddatblygu'r rhaglen ymhellach gyda'r tasgau canlynol.
Os yw eich anifail anwes yn cysgu wrth glywed sŵn uchel, rhaid iddo ymateb trwy ddangos mwy o ddicter/ofn/syndod na phan fydd yn effro.
Gair o gyngor: Gallwch roi os datganiadau y tu mewn i'w gilydd, gan greu os datganiad sydd wedi'i bentyrru.
Pwysig: Bydd eich rhaglen yn gweithio ei ffordd trwy'r rhestr o os datganiadau a arall os datganiadau yn y ddolen am byth. Bydd yn rhedeg y darn cyntaf o god os bodlonir yr amodau, ac yn gadael y gweddill.
Meddyliwch am hyn fel rhestr wirio lle rydych chi'n dychwelyd i frig y rhestr a dechrau eto ar ôl gwirio rhywbeth.
Mae hyn yn golygu bod angen i chi wirio pa un o'r amodau (sŵn uchel neu dywyllwch) sy'n dod gyntaf yn eich rhaglen a mewnosod y 'datganiad os' newydd yn yr amod perthnasol.
Defnyddiwch os ac arall ddatganiad ar gyfer hyn er mwyn penderfynu pa ymateb sŵn uchel sy'n cael ei ddangos.
Gan ein bod am glirio'r sgrin cyn y ddau opsiwn, gallwn ddefnyddio'r gorchymyn hwn unwaith cyn y os/arall datganiad newydd.
Fel arall, gallech ystyried defnyddio blociau rhesymeg uwch sy'n caniatáu sawl amod mewn os/arall os datganiad.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Yn ein rhaglen atebion, mae'r amod s&wcirc:n uchel uwchben yr amod tywyll, felly mae'r os datganiad newydd yn mynd yno.
Mae angen i'ch newidyn 'llawnder' fod ag uchafswm gwerth o 5.
Gair o gyngor: : Mae hyn yn golygu eich bod ond eisiau ychwanegu un at y gwerth llawnder pan fydd yn llai na 5 (neu'n llai na ac yn hafal i 4).
Mae angen os datganiad arnoch pan fydd y llawnder yn llai na 5 er mwyn ychwanegu at y gwerth pan fydd yn wir yn unig.
Ar hyn o bryd, does dim angen os datganiad i wneud hyn gan nad oes unrhyw gam gweithredu ar gyfer os datganiad nad yw'n wir.
Cofiwch gadw'r os datganiad hwn y tu allan i unrhyw ddolennau ailadrodd a ddefnyddir ar gyfer yr animeiddiad bwydo.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Yn hytrach na dangos gwerth llawnder i'r defnyddiwr gan ddefnyddio'r mewnbwn a ddewiswyd yn yr heriau arian, defnyddiwch y rhaglen i ddangos lefel mesurydd.
Gair o gyngor: Gallwch roi arall os datganiadau y tu mewn i os / arall os / arall datganiad.
I wneud hyn, bydd angen delwedd ar gyfer pob lefel lawnder i greu effaith mesurydd/medrydd.
Mewn rhestr datganiadau o'r fath, mae angen i chi gynnwys arall datganiad i gofnodi 0 a/neu unrhyw werthoedd annisgwyl. Gall hyn weithredu fel sgrin gwall i ni wedyn.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Fe wnaethom ddewis siâp mesurydd crwn sy'n mynd yn fwy cyflawn pan fydd y lefel lawnder yn uwch.
Gair o gyngor: Gallai helpu i symud yr animeiddiad bwyta i'r un os datganiad â phan fydd y newidyn llawnder yn cynyddu, gan sicrhau o ganlyniad bod gennych animeiddiad gwahanol pan fydd arall datganiad yn llawn.
Cofiwch fod angen dolennau ailadrodd y tu mewn i'r datganiadau hyn er mwyn ailadrodd animeiddiadau.
Wrth ddatblygu rhaglen, yn aml mae'n rhaid i ni newid lleoliadau adrannau cod er mwyn cynnwys nodweddion newydd.
I wneud hyn, mae angen atodi 'arall' i'n datganiad 'os llawnder < 5'.
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Dylai'r gwerth llawnder ostwng yn araf dros amser wrth i chwant bwyd eich anifail anwes gynyddu eto.
Gair o gyngor: Gan fod hon yn broses gefndirol na fydd yn dioddef ymyrraeth gan y ddolen am byth, gallwch ddefnyddio dolen amserydd ar wahân i wneud hyn.
Gallwch ddod o hyd i floc amserydd yn y ddewislen Dolennau.
Yr amser diofyn yw 500 ms - sef bob hanner eiliad - bydd angen i chi newid hyn (fe wnaethom ni weld bod munud - neu 60000 ms - yn addas iawn ar gyfer hyn).
Rydym am dynnu un i ffwrdd o'r llawnder fel y gallwn ddefnyddio bloc 'newid llawnder gan' gyda -1 yn hytrach nag 1.
Dydyn ni ddim eisiau gwerthoedd negyddol, felly rydym ond eisiau tynnu i ffwrdd o'r gwerth llawnder os yw dros 0 (neu'n fwy nag 1 ac yn hafal i 1).
Os ydych chi'n dal i gael trafferth, defnyddiwch y botwm ateb isod.
Mae gennych chi nawr anifail anwes rhithwir. Dyma rai syniadau ar gyfer ychwanegiadau a nodweddion eraill y gallwch chi roi cynnig arnyn nhw. Gweithgareddau i chi ymchwilio iddyn nhw a'u harchwilio yw'r rhain - does dim atebion ar gael.
Defnyddiwch y rhaglen i wneud i'r anifail anwes ddangos pan fydd chwant bwyd arno (llawnder ≤ 1).
Gair o gyngor: Gellir gwneud hyn trwy ychwanegu arall os datganiad i'ch dolen am byth.
Ychwanegwch lefel hapusrwydd a mewnbynnau chwarae yn y rhaglen. Mwya'n byd y byddwch chi'n chwarae gyda'r anifail anwes, hapusa'n byd fydd e'n teimlo.
Gair o gyngor: Efallai y byddwch am symud y mesurydd chwant bwyd fel ei fod yn dangos yn awtomatig ar ôl bwydo'r anifail anwes er mwyn rhyddhau botwm B ar gyfer hyn.
Gosodwch werth uchaf ac amser oeri ar gyfer y gwerth hapusrwydd. Sut fydd eich anifail anwes yn ymateb pan fydd y gwerth hapusrwydd yn gostwng yn rhy isel?
Gair o gyngor: Bydd hyn yn defnyddio'r un fframwaith â'n mesurydd llawnder.
Defnyddiwch y rhaglen fel bod yr anifail anwes yn tyfu dros amser os yw'n derbyn gofal priodol.
Gair o gyngor: Gallech greu newidyn sgôr ar gyfer hyn a threfnu bod yr anifail anwes yn gwella wrth i'r sgôr gyrraedd nodau penodol.
Gwers Fideo (yn Saesneg):
Ymarferion:
For this session we shall be creating a two-player dice duelling game using two BBC Micro:Bits. We recommend using the multi-editor for these exercises. Name the program on the left Player One and the other Player Two.
As with all our exercises, they are designed for learners to complete a level before moving to the next. Otherwise, you may miss information or skip a crucial step that stops your program from working.
Click on each challenge heading to expand.
Have both Micro:Bits programmed to show a random number between 1 and 6 every time it is shaken - like a dice roll.
Gair o gyngor: To avoid interference between loops, all outputs need to be inside the forever loop.
The video for Session Two included a walk-through on creating a basic dice program.
Use a different dice roll variable name for each player - this will reduce confusion later.
You only want the dice roll value to start showing after the first roll (so when the variable is no longer 0)
Player One
Player Two
For Player One, have button A show your last roll whilst button B shows the other player's last roll. Do the same for Player Two.
Gair o gyngor: Don't forget to set both Micro:Bits into the same radio group so they can talk to each other - this should be done during the start-up sequence.
Use if statements inside the forever loop for button pressing, not the separate 'ar fotwm A wedi'i wasgu' or ' on button B pressed' blocks.
Remember, you can stack if statements inside each other.
You can have an else statement that contains nothing, or you can use it to report an error.
Player One
Player Two
When either player presses the touch logo, have the screen show the signal strength.
The touch logo is only available on Micro:Bit V2 - so check the V2 section of the input menu.
This one is hard to test in the simulator because you can only alter the signal strength when it is sending information (in this case when we shake it).
Player One
Player Two
Pressing button A and B at the same time should give players the total of both players dice rolls.
Gair o gyngor: You will need to have something to check both players have rolled.
Pwysig: To check against two conditions (in this case, that both players have rolled), you could stack the if statements or you could use an 'and' block.
Stacked Conditions
The 'and' Boolean Operator
Note: A Boolean value is true of false. A Boolean Operator compares two inputs to produce a single true or false output.
Gair o gyngor: The if button A and B pressed statement needs to be put in the forever loop above the if statements for button A and button B.
Pwysig: When using else if statements, the program goes down the list of conditions and stops at the first one that is true. It will then skip the rest. When using the if button A and B pressed, any conditions checking if either of those buttons is pressed becomes true. So, 'if button A is pressed' will be true, 'if button B is pressed' will be true and 'if button A+B is pressed' will be true. This highlights the importance of the ordering of conditions.
There are blocks that do the calculations for us in the Maths menu.
You may want to add an else statement to this to show that not all players have rolled yet.
Player One
Player Two
Move the program for button A so as the Micro:Bit will show the roll on the screen automatically, include an else statement for when the dice roll value is zero. This could be a waiting animation, image, or message/instruction.
Gair o gyngor: Now you will need pauses to keep values other than the player's own roll on the screen longer.
You can move the show player's own roll program into the else statement for this.
Use 1 second (1000ms) pauses where needed.
You may need to hold down buttons for slightly longer when testing. Especially if you are using a string to show a message as it will not listen for buttons until the message has finished scrolling.
Leave the 'else os botwm A yn cael ei wasgu wedyn' statement empty for now.
Player One
Player Two
Now use Button A to reset the game.
Gair o gyngor: You will need to also send the reset command to the other player's Micro:Bit.
You can send a string, such as a word, over the radio group.
If using a string for this, you need to use the string comparison block - this is the one with quotation marks inside the value boxes.
Alternatively, you could send a different number which triggers the reset.
Check you are using the correct receiving blocks for the type of information you are sending.
Player One
Player Two
Let us now have the players duelling. Whichever player rolls the highest number wins. Have the Micro:Bits show whether their player won or lost.
Gair o gyngor: You can use the 'and' Boolean operator here to make sure both players have rolled before checking to see who won.
You need to work out where to put this in your program.
Compare the two players dice rolls to work out which is higher.
What happens when the players both roll the same number?
You can use images, strings, and/or animations for these.
Add pauses where you think they are needed.
Player One
Player Two
Upgrade the program so both players must roll twice before comparing their totals to determine the winner. Players should not be able to roll more than twice reset.
Gair o gyngor: You will need a new variable for the number of dice rolls.
Your new counter variable will need to be used in place of all conditions that currently check if the player's own roll value is over 0.
Have a message or image come up if a player tries to roll more than twice - this makes it easier to test.
The use and changing of the counter variable can be done in the 'on shake' loop.
You will need to set this new variable to zero both on start and during the reset process.
Changing the random number to be between 1 and 12 or multiplying the initial roll by two will not match the same probabilities as using two separate dice rolls - therefore, you will need to use a roll counting variable. For more information regarding probabilities of dice rolls, you can check out our Dice Duelling activity.
Player One
Player Two
Here are some extra features you can add to your dice duelling game. These are for you to investigate and explore - there are no answers provided.
Adding instructions to player screens.
Gair o gyngor: Try to keep instructions short or in picture form.
Have a score system that tracks how many times each player has won or lost.
Gair o gyngor: You can replace the programs for a button or use the touch sensor.
Let the players know if they are shaking the Micro:Bit too hard.
Gair o gyngor: This requires measuring the acceleration of the Micro:Bit, anything over a strength value of 1700mg is too much.
Add animations to the dice rolls.
Can you design a version of this game for two players using only one BBC Micro:Bit?
Gair o gyngor: This will not need any radio communications.
Gwers Fideo (yn Saesneg):
Ymarferion:
For this session we shall be creating a traffic light program using a Neopixel strip.
As with all our exercises, they are designed for learners to complete a level before moving to the next. Otherwise you may miss information or skip a crucial step that stops your program from working.
Click on each challenge heading to expand.
Use the blocks provided by the Neopixel extension to connect a 24 LED strip to pin 1.
Gair o gyngor: Don't forget to create your own start-up for this new program to identify it.
This is part of the set-up for your program, so should be done in the 'ar ddechrau' block.
Set up 3 equal size ranges to recreate a traffic light with red at the top, yellow in the middle, and green at the bottom.
Gair o gyngor: The LED strip numbering starts at 0.
24 is dividable by 3, meaning you'll need to have the ranges cover 8 LEDs each.
Have the traffic light repeatedly cycle through a crossing sequence - that is red for 10 seconds, red and yellow for 5 seconds, green for 10 seconds, and then yellow for 5 seconds.
Putting this sequence in the 'am byth' loop will ensure it repeats continuously.
Remember to turn off the un-needed colours each time (set them to black).
Move each light change into their own functions, remember to then call them in the forever loop.
Give each function a suitable name.
Add animations to the Micro:Bit to show when it is and isn't safe for pedestrians to cross the road. Do this using three new functions - one for walk, one for wait, and one for warning that the lights are changing to green for the traffic.
Gair o gyngor: You will need to time your animation to replace the use of pause blocks currently for timing the lights.
Gair o gyngor: A variable will mean you only need one function for wait that can be used for when the light is green and when it's yellow.
This is a good opportunity to practice working with the 'repeat' blocks inside the functions.
You can call a function from inside another function.
If using two images for your animations, you'll need to repeat them 10 times with half seconds pauses after each for the red and green. Only 5 repeats when the yellow light is active.
Create a traffic light colour variable for use to identify which light is currently active and use this in if/else if statements for setting the lights.
Gair o gyngor: Remember to set the variable in the 'ar ddechrau' block.
You will need to use numbers to represent the different light states.
Use an else statement to capture any errors regarding the variable value.
Have the A button on the Micro:Bit cause the traffic to come to a stop.
Gair o gyngor: You only need this over-ride to work whilst the traffic lights are green.
Pwysig: You can stop a loop early using the 'break' block found in the Dolennau menu.
You need to tell the program to change to yellow when button A is pressed.
To over-ride the program in this way, you will need to check if button A is pressed inside the relevant animation's repeat block.
You may also need to check against another variable, this can use a stacked if statement or an 'and' Boolean Operator.
Add sound to indicate when it is safe to cross for those who cannot see the visual instructions.
This just requires a single note to be played on each image change in the animation for when it is safe to start crossing (when the traffic light is red).
The below exercise is to expand the program further. This is for you to investigate and explore - there are no answers provided.
Add a second Neopixel to pin 2 and have it act as the traffic light for traffic flowing in the other direction.
How much can you tidy up your code with functions, while loops, repeat blocks, and variables?
Gwers Fideo (yn Saesneg):
Ymarferion:
For this session we shall be creating a program to turn your BBC Micro:Bit into a sound meter using a servo.
As with all our exercises, they are designed for learners to complete a level before moving to the next. Otherwise you may miss information or skip a crucial step that stops your program from working.
Click on each challenge heading to expand.
Write a program that plays an alarm when the sound level is over 200.
Gair o gyngor: Don't forget the start-up routine to identify the program.
This requires an if statement with a condition of sound level > 200.
There is a variable block for the sound level in the Input menu for the V2.
Add some pauses to reduce the rate of your chosen sound/note.
Have the Micro:Bit display the sound level on its screen.
Gair o gyngor: This can be done using a 'dangos testun' block.
This needs to be in the forever loop, outside of the current if statement.
Notice how the show string block slows down our alarm sound. Let us resolve this by replacing the number with these images and conditions:
Sound level is 0.
Sound level is over 0 and less than or equal to 51.
Sound level is over 51 and less than or equal to 102.
Sound level is over 102 and less than or equal to 153.
Sound level is over 153 and less than or equal to 204.
Sound level is over 204.
The alarm should now only sound when the meter is full.
This will require a new series of if and else if statements.
Remember you can use the 'and' Boolean operator instead of stacking if statements.
Use the else statement at the end for any errors in the program.
Add a 180° positional servo to pin 1. Program the servo to rest at 0° whilst the sound level is less than or equal to 102. Otherwise, it needs to move to 180°
Gair o gyngor: You will need to use the servo extension.
We can use all the default settings for the positional servo for this. However, it is still good practice to set the servo to a start position (0° in this case) in the 'ar ddechrau' block.
You will need to set the servo angle in each if/else if statement.
When testing, make sure you give the servo time to complete its rotation - if you switch the condition too quickly it will not behave the way we expect it to.
When the servo changes direction, can you have the servo move only 10° every 300 milliseconds? This reduces the stress on the servo, stopping it from breaking - something the simulator does not replicate.
Gair o gyngor: You will need to make sure the servo does not attempt to turn below 0° or further than 180° - this could break your servo.
You will need to create a variable for the angle - remember to set this in the 'ar ddechrau' block.
This new variable can be used to set the servo angle - changing it up or down by 10°.
When setting up your if statement conditions consider the values to use - as we're moving 10° at a time, consider using 10 and 170.
These new if statements will need to replace the set servo blocks in each if/else if statement.
As there is already a 200 millisecond pause in the > 204 statement, we need to adjust the movement to total 300.
To tidy up our code, let's move the servo instructions into their own functions and call them when needed.
Gair o gyngor: You'll need one for lowering and one for increasing the angle.
Remember the Functions menu is in the Advanced section.
To only have two functions - remove the 200 millisecond second pause from the alarm program so it too can use the 300 milliseconds pause in the servo function.
Before you start this exercise, we advise that you duplicate your program as we will be deleting a lot of the previous code.
Step 1. Close your program and return to makecode.microbit.org's homepage.
Step 2. Click on the view all option next to 'My Projects'.
Step 3. Select the file you want to duplicate (a green tick should appear on the file).
Step 4. Click on the duplicate option in the top right of the screen. This will allow you to then select a name for your new copy.
Step 5. Open your new copy and continue with the next challenge.
Instead of having a single value determining the movement of the servo, let us look at having the servo act like the arm on a sound meter (as shown below), traveling to the correct angle for the current sound level.
Pwysig: We have a range of 0° to 180° on the servo but the sound level has a range of 0 to 255. There are two ways to approach this:
Do the maths ourselves
Work out how far the meter needs to move for one unit of sound:
(180 ÷ 255) = 0.7058823529411°
Use the above value with a Maths block inside a 'set servo' block.
Use the 'map' block
The map block allows us to enter the range we're measuring (sound level) which is 0 to LED and convert it to the servo's range of 0 to 180. The block then does all the calculations for us.
We need to delete the functions we've created for the servo from our program. The 'call' blocks will automatically vanish when their function is removed.
Keep the screen meter animation in place.
A single 'set servo' block using the method chosen from above is all that's required for this.
The below exercises are designed to expand your understanding of servos. These are for you to investigate and explore - there are no answers provided.
Instead of using the meter to measure sound level, have it measure radio signal strength, with an alarm for if the signal gets too weak.
Gair o gyngor: You will need to find the range of values for the radio signal strength.
Remember the traffic light program we created last session? Now you can add a rail crossing with a servo acting as the barrier arm.
Gair o gyngor: You can only attach the servo to pins 0, 1 or 2. However, you can relocate the Neopixels to other pin numbers (up to 16).
Gwers Fideo (yn Saesneg):
Ymarferion:
For this session we shall be creating a program to control a railway crossing. This includes revision of radio communications, if-statements, variables, functions, Neopixels, and servos.
We recommend you attempt these challenges using the standard editor.
As with all our exercises, they are designed for learners to complete a level before moving to the next. Otherwise, you may miss information or skip a crucial step that stops your program from working.
Click on each challenge heading to expand.
For these exercises, imagine you have one Micro:Bit controlling the crossing whilst another is acting as a beacon on-board the train. The crossing will know a train is coming when the beacon's signal strength gets stronger.
Use an image, animation and/or text to create a start-up screen that identifies your program.
If only using an image, include a pause (500ms) so it remains on the screen long enough to see.
Try not to make the start-up take too long, otherwise this will get frustrating during testing as we progress.
Have the Micro:Bit send the number zero via radio from inside the forever loop.
Gair o gyngor: Don't forget to set a radio group for your Micro:Bit to use.
You can find the blocks you need in the Radio menu.
You need to set a radio group in the start-up sequence.
Create a beacon strength variable and have it set to the signal strength being received.
Gair o gyngor: To measure the signal strength, the program needs to first receive the sent number.
Pick a suitable name for your new variable. Some programs use lots of variables, and it helps to be able to quickly identify what each one is for.
Remember to set your new variable to 0 when the program first starts - This is good practice for when you start learning text-based programming languages.
You will need to set your new variable to the received signal strength value inside an 'on radio received' block.
We now need two functions, one for the program for when a train is coming, the other for when there isn't. Give each function a suitable name and have a different image in each.
Gair o gyngor: The images at this stage are for testing, so any will do.
The Functions menu can be found in the Advanced section.
These functions will not show in testing, as we have not called them in the program.
Call your function for when a train is coming when the signal strength is greater than or equal to -75. Otherwise, call the no train coming function.
Gair o gyngor: While testing in the simulator, treat the top Micro:Bit as the crossing controller and the bottom Micro:Bit as the train beacon.
You will need to create an if statement for this which compares the beacon strength value to -75.
The radio signal strength for the Micro:Bit in the simulator has a range of -128 (weakest signal) to -42 (strongest signal).
Remember we have several maths symbols to choose from: = equals, < less than, > greater than, ≤ less than or equal to, and ≥ greater than or equal to.
We now need to create our crossing lights. For this we need a Neopixel connected to pin 1 which is made up of 15 LEDs.
Gair o gyngor: You'll need to add the Neopixel extension to your blocks menu.
Re-visit Session Four if you need a reminder of how to get and use the Neopixel extension blocks.
You will need to change the default length from 24 to 15 LEDs.
Set up two ranges, with suitable names - one for the top 5 LEDs and another for the bottom 5 LEDs.
Gair o gyngor: Remember that counting in computing starts at zero.
The first range will start at 0, whilst the bottom range will start at 10.
Remove the image in your function for when a train is coming and replace it with a program that will turn the lights on and off (alternating between the top and the bottom) three times. Include a pause of 500ms after each light turns on.
Gair o gyngor: Remember that setting a light to black turns it off.
Each time a light turns on, the other needs to turn off.
You can use a 'ailadfrodd 3 o weithiau' block to shorten the program.
Replace the image in you function for when a train is not approaching with a program to make sure the lights are all turned off.
You will need to set both of our light ranges to black in the function for when there is no train coming.
Have your program play a middle C note when the top light is on and a middle E note when the bottom light is on. This is our alarm to warn drivers and pedestrians a train is coming.
Gair o gyngor: When testing, make sure the top Micro:Bit (our 'crossing') has a very low signal strength or the alarms on both Micro:Bits may merge and/or be out of sync.
You only want the notes to be 1 beat long.
You can change the note inside the 'play tone' block.
For our railway crossing barrier we shall use a servo to control its movement. This needs to be connected to pin 2 and be in the open position (0°) at the start of the program.
Gair o gyngor: This will require the Servos extension.
If stuck, please look back at Session Five.
When a train is approaching, we want the lights and alarm to sound three times and then for the barrier to close (move to 90°).
Be careful not to place this new instruction inside the repeat loop.
Remember that the servo is on pin 2.
Once the barrier is closed, we need the alarm to stop while the lights continue to flash.
Gair o gyngor: You will need a way to check the angle of the servo.
You will need a servo angle variable.
This new variable will need to be updated each time the barrier opens or closes.
Move the program with the lights and alarm into an if statement for when the barrier is open.
For when the barrier is closed, have the lights continue to flash. As long as the barrier is down, this will keep repeating, so you don't need to use a repeat block here.
Once the train has passed and the beacon signal fades to less than 75 again, we want the barrier to open (retuning to 0°).
Gair o gyngor: Remember to also reset your new angle variable at the same time.
You can use the angle variable to tell if the gate needs opening. This is the opposite to the check we've already done to see if it needs closing.
Don't forget that our servo is attached to pin 2.
At the moment, the servo is moving too fast. This could cause injury to a pedestrian or damage a passing vehicle. So we need the barrier to lower 5° every 200ms. When it is opening, it is safer to go faster - in this case 20° every 300ms.
Gair o gyngor: Turn both the red lights on fully during these movements as the flashing will stop during these movements.
Our function for when our train is coming will need an else if statement for when the barrier is only partially closed.
You will need to use the angle variable in the maths conditions.
Remember you can also use the 'and' Boolean block demonstrated previously if you want to check against two values.
Perhaps create new functions for the opening and closing movements. Yes, you can call a function inside another function.
When opening the barrier be aware that 90 cannot be divided by 20. Think about how you will make sure the barrier opens fully without going too far and breaking the servo.
This section is an additional activity for you to try out - this will provide an opportunity for revision whilst introducing some new blocks and terms.
As with all our exercises, it is best to work through this is order.
Select a heading to expand.
Create a basic dice rolling program on your Micro:Bit. This should show a random number between 1 and 6 on the screen when shaken.
Gair o gyngor: Don't forget your start up screen.
If stuck, revisit sessions two and three.
This does not require a forever loop.
Instead of showing a number, have the screen show the following images depending on the value rolled.
One
Two
Three
Four
Five
Six
Gair o gyngor: You will need to create a variable to hold the dice roll value.
You will need a different if/else if statement for each possible value. You can then use the else statement to catch any errors.
A Magic-8 Ball is like a dice, put instead of numbers it produces answers when shaken.
Instead of showing numbers in your program, have the Micro:Bit display the answers yes, no, maybe, go for it, good idea, bad idea, don't know, definitely, absolutely not, and no idea.
Gair o gyngor: There are now 10 options.
For the first six options you can simply replace the current images.
You will then need to add four more else if statements.
Don't forget to change the random number generator to have 10 options instead of 6.
There is a different way we could have approached this program. We could have used something called an array. Array blocks can be found in the Advanced menu.
An array is a special kind of variable. Instead of holding only a single piece of information like the variables we've used, it can hold a list of values/strings.
You can then call a value from the array by its location in the list. As with most coding, the numbering of list items starts at zero.
Example:
Let's say we wanted to write a program that randomly selected a string from a list of apple, orange, and banana when we press button A.
As with any variable, we need to set the array in the 'ar ddechrau' section:
We can add or take away items to the array using the plus and minus buttons on the block.
To have the screen show a random item from the array we can use the 'dangos testun' combined with a 'get random value from' array block.
We now have a complete program that randomly selects an item from the list and displays it on the screen when we press button A.
As the Magic-8 Ball program has a single variable which has a list of different strings (the answers) we could use an array and have the program randomly select from a list instead of using such a large if/else if/else statement.
Pwysig: Arrays cannot be used to replace all if and else if statements. With Makecode, they can only be used for lists of strings or numbers. For example, you could not use this for the dice program with different images for each value.
Change your Magic-8 Ball program to use an array for all possible answers and randomly select from it when shaken.
Gair o gyngor: You may want to duplicate your file first so you can compare them later.
Use the fruit list program in the example and replace the fruit with the Magic-8 Ball answers provided in the silver exercise.
Make sure you are using the text list block, the number version will error if you add words.
Remember, you can add more items to the array using the plus symbol on the set-up block.
Rename the list to something more suitable than fruit.
If you haven't already, re-design the start sequence for the Magic-8 Ball instead of the dice.
Now that you've discovered random generators using arrays, there are number of different fun things you can create. Here are some ideas.
A volunteer selector - you can create an array containing all the names of people in your class and next time no one volunteers, you can use it to select someone randomly.
Creative writing program - have a series of arrays to help put together a storyline idea. For example, you could have random location/genre/character/sidekick generators.
Shopping mayhem app - put your shopping list into an array and then use the random generator to decide what order to shop in.
Gair o gyngor: You may want to do some research on how to remove items from an array after they've come up.