blocks_microbit.min.js 165 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789
  1. 'use strict';
  2. goog.provide('Blockly.Blocks.microbit');
  3. goog.require('Blockly.Blocks');
  4. goog.require('Blockly.constants');
  5. //Blockly.FieldColour.COLOURS = "#f00 #e00 #d00 #c00 #b00 #a00 #800 #600 #400 #000".split(" ");
  6. //Blockly.FieldColour.COLUMNS = 5;
  7. Blockly.Blocks.botbit_rec_from_microbit = {
  8. init: function () {
  9. this.jsonInit({
  10. inputsInline: !0,
  11. nextStatement: null,
  12. previousStatement: null,
  13. colour: 30,
  14. helpUrl: Blockly.Msg.BOTBIT_REC_FROM_MICROBIT_HELPURL,
  15. tooltip: Blockly.Msg.BOTBIT_REC_FROM_MICROBIT_TOOLTIP,
  16. message0: Blockly.Msg.BOTBIT_REC_FROM_MICROBIT_MESSAGE0
  17. })
  18. }
  19. };
  20. Blockly.Blocks.microbit_update_msg_args = {
  21. init: function () {
  22. this.jsonInit({
  23. inputsInline: !1,
  24. nextStatement: null,
  25. previousStatement: null,
  26. colour: 30,
  27. helpUrl: Blockly.Msg.MICROBIT_UPDATE_MSG_ARGS_HELPURL,
  28. tooltip: Blockly.Msg.MICROBIT_UPDATE_MSG_ARGS_TOOLTIP,
  29. message0: Blockly.Msg.MICROBIT_UPDATE_MSG_ARGS_MESSAGE0,
  30. args0: [{
  31. type: "input_value",
  32. name: "msg"
  33. }, {
  34. type: "input_dummy"
  35. }, {
  36. check: "Number",
  37. type: "input_value",
  38. name: "x"
  39. }, {
  40. check: "Number",
  41. type: "input_value",
  42. name: "y"
  43. }, {
  44. check: "Number",
  45. type: "input_value",
  46. name: "z"
  47. }, {
  48. check: "Boolean",
  49. type: "input_value",
  50. name: "L"
  51. }, {
  52. check: "Boolean",
  53. type: "input_value",
  54. name: "R"
  55. }]
  56. })
  57. }
  58. };
  59. Blockly.Blocks.microbit_accelerometer_get_x = {
  60. init: function () {
  61. this.jsonInit({
  62. colour: 0,
  63. output: "Number",
  64. helpUrl: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_X_HELPURL,
  65. tooltip: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_X_TOOLTIP,
  66. message0: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_X_MESSAGE0
  67. })
  68. }
  69. };
  70. Blockly.Blocks.microbit_accelerometer_get_y = {
  71. init: function () {
  72. this.jsonInit({
  73. colour: 0,
  74. output: "Number",
  75. helpUrl: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_Y_HELPURL,
  76. tooltip: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_Y_TOOLTIP,
  77. message0: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_Y_MESSAGE0
  78. })
  79. }
  80. };
  81. Blockly.Blocks.microbit_accelerometer_get_z = {
  82. init: function () {
  83. this.jsonInit({
  84. colour: 0,
  85. output: "Number",
  86. helpUrl: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_Z_HELPURL,
  87. tooltip: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_Z_TOOLTIP,
  88. message0: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_Z_MESSAGE0
  89. })
  90. }
  91. };
  92. Blockly.Blocks.microbit_accelerometer_was_gesture = {
  93. init: function () {
  94. this.jsonInit({
  95. colour: 0,
  96. args0: [{
  97. name: "gesture",
  98. options: [[Blockly.Msg.MICROBIT_GESTURE_SHAKE, "shake"], [Blockly.Msg.MICROBIT_GESTURE_UP, "up"], [Blockly.Msg.MICROBIT_GESTURE_DOWN, "down"], [Blockly.Msg.MICROBIT_GESTURE_LEFT, "left"], [Blockly.Msg.MICROBIT_GESTURE_RIGHT, "right"], [Blockly.Msg.MICROBIT_GESTURE_FACE_UP, "face up"], [Blockly.Msg.MICROBIT_GESTURE_FACE_DOWN, "face down"], [Blockly.Msg.MICROBIT_GESTURE_FREEFAIL, "freefall"], ["3g", "3g"], ["6g", "6g"], ["8g", "8g"]],
  99. type: "field_dropdown"
  100. }],
  101. output: "Boolean",
  102. helpUrl: Blockly.Msg.MICROBIT_ACCELEROMETER_WAS_GESTURE_HELPURL,
  103. tooltip: Blockly.Msg.MICROBIT_ACCELEROMETER_WAS_GESTURE_TOOLTIP,
  104. message0: Blockly.Msg.MICROBIT_ACCELEROMETER_WAS_GESTURE_MESSAGE0
  105. })
  106. }
  107. };
  108. Blockly.Blocks.microbit_accelerometer_is_gesture = {
  109. init: function () {
  110. this.jsonInit({
  111. colour: 0,
  112. args0: [{
  113. name: "gesture",
  114. options: [[Blockly.Msg.MICROBIT_GESTURE_SHAKE, "shake"], [Blockly.Msg.MICROBIT_GESTURE_UP, "up"], [Blockly.Msg.MICROBIT_GESTURE_DOWN, "down"], [Blockly.Msg.MICROBIT_GESTURE_LEFT, "left"], [Blockly.Msg.MICROBIT_GESTURE_RIGHT, "right"], [Blockly.Msg.MICROBIT_GESTURE_FACE_UP, "face up"], [Blockly.Msg.MICROBIT_GESTURE_FACE_DOWN, "face down"], [Blockly.Msg.MICROBIT_GESTURE_FREEFAIL, "freefall"], ["3g", "3g"], ["6g", "6g"], ["8g", "8g"]],
  115. type: "field_dropdown"
  116. }],
  117. output: "Boolean",
  118. helpUrl: Blockly.Msg.MICROBIT_ACCELEROMETER_IS_GESTURE_HELPURL,
  119. tooltip: Blockly.Msg.MICROBIT_ACCELEROMETER_IS_GESTURE_TOOLTIP,
  120. message0: Blockly.Msg.MICROBIT_ACCELEROMETER_IS_GESTURE_MESSAGE0
  121. })
  122. }
  123. };
  124. Blockly.Blocks.microbit_accelerometer_get_gestures = {
  125. init: function () {
  126. this.jsonInit({
  127. colour: 0,
  128. output: "Array",
  129. helpUrl: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_GESTURES_HELPURL,
  130. tooltip: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_GESTURES_TOOLTIP,
  131. message0: Blockly.Msg.MICROBIT_ACCELEROMETER_GET_GESTURES_MESSAGE0
  132. })
  133. }
  134. };
  135. Blockly.Blocks.microbit_accelerometer_current_gesture = {
  136. init: function () {
  137. this.jsonInit({
  138. colour: 0,
  139. output: "String",
  140. helpUrl: Blockly.Msg.MICROBIT_ACCELEROMETER_CURRENT_GESTURE_HELPURL,
  141. tooltip: Blockly.Msg.MICROBIT_ACCELEROMETER_CURRENT_GESTURE_TOOLTIP,
  142. message0: Blockly.Msg.MICROBIT_ACCELEROMETER_CURRENT_GESTURE_MESSAGE0
  143. })
  144. }
  145. };
  146. Blockly.Blocks.microbit_button_is_pressed = {
  147. init: function () {
  148. this.jsonInit({
  149. colour: 32,
  150. args0: [{
  151. name: "button",
  152. options: [["A", "a"], ["B", "b"]],
  153. type: "field_dropdown"
  154. }],
  155. output: "Boolean",
  156. helpUrl: Blockly.Msg.MICROBIT_BUTTON_IS_PRESSED_HELPURL,
  157. tooltip: Blockly.Msg.MICROBIT_BUTTON_IS_PRESSED_TOOLTIP,
  158. message0: Blockly.Msg.MICROBIT_BUTTON_IS_PRESSED_MESSAGE0
  159. })
  160. }
  161. };
  162. Blockly.Blocks.microbit_button_was_pressed = {
  163. init: function () {
  164. this.jsonInit({
  165. colour: 32,
  166. args0: [{
  167. name: "button",
  168. options: [["A", "a"], ["B", "b"]],
  169. type: "field_dropdown"
  170. }],
  171. output: "Boolean",
  172. helpUrl: Blockly.Msg.MICROBIT_BUTTON_WAS_PRESSED_HELPURL,
  173. tooltip: Blockly.Msg.MICROBIT_BUTTON_WAS_PRESSED_TOOLTIP,
  174. message0: Blockly.Msg.MICROBIT_BUTTON_WAS_PRESSED_MESSAGE0
  175. })
  176. }
  177. };
  178. Blockly.Blocks.microbit_button_get_presses = {
  179. init: function () {
  180. this.jsonInit({
  181. colour: 32,
  182. args0: [{
  183. name: "button",
  184. options: [["A", "a"], ["B", "b"]],
  185. type: "field_dropdown"
  186. }],
  187. output: "Number",
  188. helpUrl: Blockly.Msg.MICROBIT_BUTTON_GET_PRESSES_HELPURL,
  189. tooltip: Blockly.Msg.MICROBIT_BUTTON_GET_PRESSES_TOOLTIP,
  190. message0: Blockly.Msg.MICROBIT_BUTTON_GET_PRESSES_MESSAGE0
  191. })
  192. }
  193. };
  194. Blockly.Blocks.microbit_compass_calibrate = {
  195. init: function () {
  196. this.jsonInit({
  197. colour: 64,
  198. nextStatement: null,
  199. previousStatement: null,
  200. helpUrl: Blockly.Msg.MICROBIT_COMPASS_CALIBRATE_HELPURL,
  201. tooltip: Blockly.Msg.MICROBIT_COMPASS_CALIBRATE_TOOLTIP,
  202. message0: Blockly.Msg.MICROBIT_COMPASS_CALIBRATE_MESSAGE0
  203. })
  204. }
  205. };
  206. Blockly.Blocks.microbit_compass_is_calibrated = {
  207. init: function () {
  208. this.jsonInit({
  209. colour: 64,
  210. output: "Boolean",
  211. helpUrl: Blockly.Msg.MICROBIT_COMPASS_IS_CALIBRATED_HELPURL,
  212. tooltip: Blockly.Msg.MICROBIT_COMPASS_IS_CALIBRATED_TOOLTIP,
  213. message0: Blockly.Msg.MICROBIT_COMPASS_IS_CALIBRATED_MESSAGE0
  214. })
  215. }
  216. };
  217. Blockly.Blocks.microbit_compass_heading = {
  218. init: function () {
  219. this.jsonInit({
  220. colour: 64,
  221. output: "Number",
  222. helpUrl: Blockly.Msg.MICROBIT_COMPASS_HEADING_HELPURL,
  223. tooltip: Blockly.Msg.MICROBIT_COMPASS_HEADING_TOOLTIP,
  224. message0: Blockly.Msg.MICROBIT_COMPASS_HEADING_MESSAGE0
  225. })
  226. }
  227. };
  228. Blockly.Blocks.microbit_compass_get_field_strength = {
  229. init: function () {
  230. this.jsonInit({
  231. colour: 64,
  232. output: "Number",
  233. helpUrl: Blockly.Msg.MICROBIT_COMPASS_GET_FIELD_STRENGTH_HELPURL,
  234. tooltip: Blockly.Msg.MICROBIT_COMPASS_GET_FIELD_STRENGTH_TOOLTIP,
  235. message0: Blockly.Msg.MICROBIT_COMPASS_GET_FIELD_STRENGTH_MESSAGE0
  236. })
  237. }
  238. };
  239. Blockly.Blocks.microbit_compass_x = {
  240. init: function () {
  241. this.jsonInit({
  242. colour: 64,
  243. output: "Number",
  244. helpUrl: Blockly.Msg.MICROBIT_COMPASS_X_HELPURL,
  245. tooltip: Blockly.Msg.MICROBIT_COMPASS_X_TOOLTIP,
  246. message0: Blockly.Msg.MICROBIT_COMPASS_X_MESSAGE0
  247. })
  248. }
  249. };
  250. Blockly.Blocks.microbit_compass_y = {
  251. init: function () {
  252. this.jsonInit({
  253. colour: 64,
  254. output: "Number",
  255. helpUrl: Blockly.Msg.MICROBIT_COMPASS_Y_HELPURL,
  256. tooltip: Blockly.Msg.MICROBIT_COMPASS_Y_TOOLTIP,
  257. message0: Blockly.Msg.MICROBIT_COMPASS_Y_MESSAGE0
  258. })
  259. }
  260. };
  261. Blockly.Blocks.microbit_compass_z = {
  262. init: function () {
  263. this.jsonInit({
  264. colour: 64,
  265. output: "Number",
  266. helpUrl: Blockly.Msg.MICROBIT_COMPASS_Z_HELPURL,
  267. tooltip: Blockly.Msg.MICROBIT_COMPASS_Z_TOOLTIP,
  268. message0: Blockly.Msg.MICROBIT_COMPASS_Z_MESSAGE0
  269. })
  270. }
  271. };
  272. Blockly.Blocks.microbit_display_get_pixel = {
  273. init: function () {
  274. this.jsonInit({
  275. args0: [{
  276. check: "Number",
  277. type: "input_value",
  278. name: "x"
  279. }, {
  280. check: "Number",
  281. type: "input_value",
  282. name: "y"
  283. }],
  284. inputsInline: !0,
  285. output: "Number",
  286. colour: 96,
  287. helpUrl: Blockly.Msg.MICROBIT_DISPLAY_GET_PIXEL_HELPURL,
  288. tooltip: Blockly.Msg.MICROBIT_DISPLAY_GET_PIXEL_TOOLTIP,
  289. message0: Blockly.Msg.MICROBIT_DISPLAY_GET_PIXEL_MESSAGE0
  290. })
  291. }
  292. };
  293. Blockly.Blocks.microbit_display_set_pixel = {
  294. init: function () {
  295. this.jsonInit({
  296. inputsInline: !0,
  297. nextStatement: null,
  298. previousStatement: null,
  299. colour: 96,
  300. helpUrl: Blockly.Msg.MICROBIT_DISPLAY_SET_PIXEL_HELPURL,
  301. tooltip: Blockly.Msg.MICROBIT_DISPLAY_SET_PIXEL_TOOLTIP,
  302. message0: Blockly.Msg.MICROBIT_DISPLAY_SET_PIXEL_MESSAGE0,
  303. args0: [{
  304. check: "Number",
  305. type: "input_value",
  306. name: "x"
  307. }, {
  308. check: "Number",
  309. type: "input_value",
  310. name: "y"
  311. }, {
  312. check: "Number",
  313. type: "input_value",
  314. name: "value"
  315. }]
  316. })
  317. }
  318. };
  319. Blockly.Blocks.microbit_display_clear = {
  320. init: function () {
  321. this.jsonInit({
  322. colour: 96,
  323. nextStatement: null,
  324. previousStatement: null,
  325. helpUrl: Blockly.Msg.MICROBIT_DISPLAY_CLEAR_HELPURL,
  326. tooltip: Blockly.Msg.MICROBIT_DISPLAY_CLEAR_TOOLTIP,
  327. message0: Blockly.Msg.MICROBIT_DISPLAY_CLEAR_MESSAGE0
  328. })
  329. }
  330. };
  331. Blockly.Blocks.microbit_display_show_image = {
  332. init: function () {
  333. this.jsonInit({
  334. colour: 96,
  335. nextStatement: null,
  336. previousStatement: null,
  337. helpUrl: Blockly.Msg.MICROBIT_DISPLAY_SHOW_IMAGE_HELPURL,
  338. tooltip: Blockly.Msg.MICROBIT_DISPLAY_SHOW_IMAGE_TOOLTIP,
  339. message0: Blockly.Msg.MICROBIT_DISPLAY_SHOW_IMAGE_MESSAGE0,
  340. args0: [{
  341. check: ["microbit_image", "String"],
  342. type: "input_value",
  343. name: "image"
  344. }]
  345. })
  346. }
  347. };
  348. Blockly.Blocks.microbit_display_show_image_with_bri = {
  349. init: function () {
  350. this.jsonInit({
  351. inputsInline: !0,
  352. colour: 96,
  353. nextStatement: null,
  354. previousStatement: null,
  355. helpUrl: Blockly.Msg.MICROBIT_DISPLAY_SHOW_IMAGE_HELPURL,
  356. tooltip: Blockly.Msg.MICROBIT_DISPLAY_SHOW_IMAGE_WITH_BRI_TOOLTIP,
  357. message0: Blockly.Msg.MICROBIT_DISPLAY_SHOW_IMAGE_WITH_BRI_MESSAGE0,
  358. args0: [{
  359. check: "Number",
  360. type: "input_value",
  361. name: "bri1"
  362. }, {
  363. check: "Number",
  364. type: "input_value",
  365. name: "bri2"
  366. }, {
  367. check: ["microbit_image", "String"],
  368. type: "input_value",
  369. name: "image"
  370. }]
  371. })
  372. }
  373. };
  374. Blockly.Blocks.microbit_display_show_animation = {
  375. init: function () {
  376. this.jsonInit({
  377. colour: 96,
  378. nextStatement: null,
  379. previousStatement: null,
  380. helpUrl: Blockly.Msg.MICROBIT_DISPLAY_SHOW_ANIMATION_HELPURL,
  381. tooltip: Blockly.Msg.MICROBIT_DISPLAY_SHOW_ANIMATION_TOOLTIP,
  382. message0: Blockly.Msg.MICROBIT_DISPLAY_SHOW_ANIMATION_MESSAGE0,
  383. args0: [{
  384. check: ["Array", "String"],
  385. type: "input_value",
  386. name: "images"
  387. }, {
  388. min: 0,
  389. value: 400,
  390. type: "field_number",
  391. name: "delay"
  392. }, {
  393. type: "input_dummy"
  394. }, {
  395. checked: !0,
  396. type: "field_checkbox",
  397. name: "wait"
  398. }, {
  399. type: "input_dummy"
  400. }, {
  401. checked: !1,
  402. type: "field_checkbox",
  403. name: "loop"
  404. }, {
  405. type: "input_dummy"
  406. }, {
  407. checked: !1,
  408. type: "field_checkbox",
  409. name: "clear"
  410. }]
  411. })
  412. }
  413. };
  414. Blockly.Blocks.microbit_display_scroll = {
  415. init: function () {
  416. this.jsonInit({
  417. colour: 96,
  418. nextStatement: null,
  419. previousStatement: null,
  420. helpUrl: Blockly.Msg.MICROBIT_DISPLAY_SCROLL_HELPURL,
  421. tooltip: Blockly.Msg.MICROBIT_DISPLAY_SCROLL_TOOLTIP,
  422. message0: Blockly.Msg.MICROBIT_DISPLAY_SCROLL_MESSAGE0,
  423. args0: [{
  424. check: "String",
  425. type: "input_value",
  426. name: "message"
  427. }]
  428. })
  429. }
  430. };
  431. Blockly.Blocks.microbit_display_scroll_animation = {
  432. init: function () {
  433. this.jsonInit({
  434. colour: 96,
  435. nextStatement: null,
  436. previousStatement: null,
  437. helpUrl: Blockly.Msg.MICROBIT_DISPLAY_SCROLL_ANIMATION_HELPURL,
  438. tooltip: Blockly.Msg.MICROBIT_DISPLAY_SCROLL_ANIMATION_TOOLTIP,
  439. message0: Blockly.Msg.MICROBIT_DISPLAY_SCROLL_ANIMATION_MESSAGE0,
  440. args0: [{
  441. check: "String",
  442. type: "input_value",
  443. name: "message"
  444. }, {
  445. min: 0,
  446. value: 150,
  447. type: "field_number",
  448. name: "delay"
  449. }, {
  450. type: "input_dummy"
  451. }, {
  452. checked: !0,
  453. type: "field_checkbox",
  454. name: "wait"
  455. }, {
  456. type: "input_dummy"
  457. }, {
  458. checked: !1,
  459. type: "field_checkbox",
  460. name: "loop"
  461. }, {
  462. type: "input_dummy"
  463. }, {
  464. checked: !0,
  465. type: "field_checkbox",
  466. name: "monospace"
  467. }]
  468. })
  469. }
  470. };
  471. Blockly.Blocks.microbit_display_on = {
  472. init: function () {
  473. this.jsonInit({
  474. colour: 96,
  475. nextStatement: null,
  476. previousStatement: null,
  477. helpUrl: Blockly.Msg.MICROBIT_DISPLAY_ON_HELPURL,
  478. tooltip: Blockly.Msg.MICROBIT_DISPLAY_ON_TOOLTIP,
  479. message0: Blockly.Msg.MICROBIT_DISPLAY_ON_MESSAGE0
  480. })
  481. }
  482. };
  483. Blockly.Blocks.microbit_display_off = {
  484. init: function () {
  485. this.jsonInit({
  486. colour: 96,
  487. nextStatement: null,
  488. previousStatement: null,
  489. helpUrl: Blockly.Msg.MICROBIT_DISPLAY_OFF_HELPURL,
  490. tooltip: Blockly.Msg.MICROBIT_DISPLAY_OFF_TOOLTIP,
  491. message0: Blockly.Msg.MICROBIT_DISPLAY_OFF_MESSAGE0
  492. })
  493. }
  494. };
  495. Blockly.Blocks.microbit_display_is_on = {
  496. init: function () {
  497. this.jsonInit({
  498. colour: 96,
  499. output: "Boolean",
  500. helpUrl: Blockly.Msg.MICROBIT_DISPLAY_IS_ON_HELPURL,
  501. tooltip: Blockly.Msg.MICROBIT_DISPLAY_IS_ON_TOOLTIP,
  502. message0: Blockly.Msg.MICROBIT_DISPLAY_IS_ON_MESSAGE0
  503. })
  504. }
  505. };
  506. Blockly.Blocks.microbit_image_builtins = {
  507. init: function () {
  508. this.jsonInit({
  509. colour: 128,
  510. args0: [{
  511. name: "image",
  512. options: [[Blockly.Msg.MICROBIT_IMAGE_HEART, "HEART"], [Blockly.Msg.MICROBIT_IMAGE_HEART_SMALL, "HEART_SMALL"], [Blockly.Msg.MICROBIT_IMAGE_HAPPY, "HAPPY"], [Blockly.Msg.MICROBIT_IMAGE_SMILE, "SMILE"], [Blockly.Msg.MICROBIT_IMAGE_SAD, "SAD"], [Blockly.Msg.MICROBIT_IMAGE_CONFUSED, "CONFUSED"], [Blockly.Msg.MICROBIT_IMAGE_ANGRY, "ANGRY"], [Blockly.Msg.MICROBIT_IMAGE_ASLEEP, "ASLEEP"], [Blockly.Msg.MICROBIT_IMAGE_SUPRISED, "SURPRISED"], [Blockly.Msg.MICROBIT_IMAGE_SILLY, "SILLY"], [Blockly.Msg.MICROBIT_IMAGE_FABULOUS, "FABULOUS"], [Blockly.Msg.MICROBIT_IMAGE_MEH, "MEH"], [Blockly.Msg.MICROBIT_IMAGE_YES, "YES"], [Blockly.Msg.MICROBIT_IMAGE_NO, "NO"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK12, "CLOCK12"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK11, "CLOCK11"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK10, "CLOCK10"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK9, "CLOCK9"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK8, "CLOCK8"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK7, "CLOCK7"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK6, "CLOCK6"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK5, "CLOCK5"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK4, "CLOCK4"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK3, "CLOCK3"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK2, "CLOCK2"], [Blockly.Msg.MICROBIT_IMAGE_CLOCK1, "CLOCK1"], [Blockly.Msg.MICROBIT_IMAGE_ARROW_N, "ARROW_N"], [Blockly.Msg.MICROBIT_IMAGE_ARROW_NE, "ARROW_NE"], [Blockly.Msg.MICROBIT_IMAGE_ARROW_E, "ARROW_E"], [Blockly.Msg.MICROBIT_IMAGE_ARROW_SE, "ARROW_SE"], [Blockly.Msg.MICROBIT_IMAGE_ARROW_S, "ARROW_S"], [Blockly.Msg.MICROBIT_IMAGE_ARROW_SW, "ARROW_SW"], [Blockly.Msg.MICROBIT_IMAGE_ARROW_W, "ARROW_W"], [Blockly.Msg.MICROBIT_IMAGE_ARROW_NW, "ARROW_NW"], [Blockly.Msg.MICROBIT_IMAGE_TRIANGLE, "TRIANGLE"], [Blockly.Msg.MICROBIT_IMAGE_TRIANGLE_LEFT, "TRIANGLE_LEFT"], [Blockly.Msg.MICROBIT_IMAGE_CHESSBOARD, "CHESSBOARD"], [Blockly.Msg.MICROBIT_IMAGE_DIAMOND, "DIAMOND"], [Blockly.Msg.MICROBIT_IMAGE_DIAMOND_SMALL, "DIAMOND_SMALL"], [Blockly.Msg.MICROBIT_IMAGE_SQUARE, "SQUARE"], [Blockly.Msg.MICROBIT_IMAGE_SQUARE_SMALL, "SQUARE_SMALL"], [Blockly.Msg.MICROBIT_IMAGE_RABBIT, "RABBIT"], [Blockly.Msg.MICROBIT_IMAGE_COW, "COW"], [Blockly.Msg.MICROBIT_IMAGE_MUSIC_CROTCHET, "MUSIC_CROTCHET"], [Blockly.Msg.MICROBIT_IMAGE_MUSIC_QUAVER, "MUSIC_QUAVER"], [Blockly.Msg.MICROBIT_IMAGE_MUSIC_QUAVERS, "MUSIC_QUAVERS"], [Blockly.Msg.MICROBIT_IMAGE_PITCHFORK, "PITCHFORK"], [Blockly.Msg.MICROBIT_IMAGE_XMAS, "XMAS"], [Blockly.Msg.MICROBIT_IMAGE_PACMAN, "PACMAN"], [Blockly.Msg.MICROBIT_IMAGE_TARGET, "TARGET"], [Blockly.Msg.MICROBIT_IMAGE_TSHIRT, "TSHIRT"], [Blockly.Msg.MICROBIT_IMAGE_ROLLERSKATE, "ROLLERSKATE"], [Blockly.Msg.MICROBIT_IMAGE_DUCK, "DUCK"], [Blockly.Msg.MICROBIT_IMAGE_HOUSE, "HOUSE"], [Blockly.Msg.MICROBIT_IMAGE_TORTOISE, "TORTOISE"], [Blockly.Msg.MICROBIT_IMAGE_BUTTERFLY, "BUTTERFLY"], [Blockly.Msg.MICROBIT_IMAGE_STICKFIGURE, "STICKFIGURE"], [Blockly.Msg.MICROBIT_IMAGE_GHOST, "GHOST"], [Blockly.Msg.MICROBIT_IMAGE_SWORD, "SWORD"], [Blockly.Msg.MICROBIT_IMAGE_GIRAFFE, "GIRAFFE"], [Blockly.Msg.MICROBIT_IMAGE_SKULL, "SKULL"], [Blockly.Msg.MICROBIT_IMAGE_UMBRELLA, "UMBRELLA"], [Blockly.Msg.MICROBIT_IMAGE_SNAKE, "SNAKE"], [Blockly.Msg.MICROBIT_IMAGE_ALL_CLOCKS, "ALL_CLOCKS"], [Blockly.Msg.MICROBIT_IMAGE_ALL_ARROWS, "ALL_ARROWS"]],
  513. type: "field_dropdown"
  514. }],
  515. output: ["microbit_image", "Array"],
  516. helpUrl: Blockly.Msg.MICROBIT_IMAGE_BUILTINS_HELPURL,
  517. tooltip: Blockly.Msg.MICROBIT_IMAGE_BUILTINS_TOOLTIP,
  518. message0: Blockly.Msg.MICROBIT_IMAGE_BUILTINS_MESSAGE0
  519. })
  520. }
  521. };
  522. Blockly.Blocks.microbit_image_copy = {
  523. init: function () {
  524. this.jsonInit({
  525. colour: 128,
  526. args0: [{
  527. check: "microbit_image",
  528. type: "input_value",
  529. name: "image"
  530. }],
  531. output: "microbit_image",
  532. helpUrl: Blockly.Msg.MICROBIT_IMAGE_COPY_HELPURL,
  533. tooltip: Blockly.Msg.MICROBIT_IMAGE_COPY_TOOLTIP,
  534. message0: Blockly.Msg.MICROBIT_IMAGE_COPY_MESSAGE0
  535. })
  536. }
  537. };
  538. Blockly.Blocks.microbit_image_invert = {
  539. init: function () {
  540. this.jsonInit({
  541. colour: 128,
  542. args0: [{
  543. check: "microbit_image",
  544. type: "input_value",
  545. name: "image"
  546. }],
  547. output: "microbit_image",
  548. helpUrl: Blockly.Msg.MICROBIT_IMAGE_INVERT_HELPURL,
  549. tooltip: Blockly.Msg.MICROBIT_IMAGE_INVERT_TOOLTIP,
  550. message0: Blockly.Msg.MICROBIT_IMAGE_INVERT_MESSAGE0
  551. })
  552. }
  553. };
  554. Blockly.Blocks.microbit_image_create = {
  555. init: function () {
  556. this.jsonInit({
  557. colour: 128,
  558. args0: [{
  559. type: "input_dummy"
  560. }, {
  561. colour: "#000000",
  562. type: "field_colour",
  563. name: "00"
  564. }, {
  565. colour: "#000000",
  566. type: "field_colour",
  567. name: "01"
  568. }, {
  569. colour: "#000000",
  570. type: "field_colour",
  571. name: "02"
  572. }, {
  573. colour: "#000000",
  574. type: "field_colour",
  575. name: "03"
  576. }, {
  577. colour: "#000000",
  578. type: "field_colour",
  579. name: "04"
  580. }, {
  581. type: "input_dummy"
  582. }, {
  583. colour: "#000000",
  584. type: "field_colour",
  585. name: "10"
  586. }, {
  587. colour: "#000000",
  588. type: "field_colour",
  589. name: "11"
  590. }, {
  591. colour: "#000000",
  592. type: "field_colour",
  593. name: "12"
  594. }, {
  595. colour: "#000000",
  596. type: "field_colour",
  597. name: "13"
  598. }, {
  599. colour: "#000000",
  600. type: "field_colour",
  601. name: "14"
  602. }, {
  603. type: "input_dummy"
  604. }, {
  605. colour: "#000000",
  606. type: "field_colour",
  607. name: "20"
  608. }, {
  609. colour: "#000000",
  610. type: "field_colour",
  611. name: "21"
  612. }, {
  613. colour: "#000000",
  614. type: "field_colour",
  615. name: "22"
  616. }, {
  617. colour: "#000000",
  618. type: "field_colour",
  619. name: "23"
  620. }, {
  621. colour: "#000000",
  622. type: "field_colour",
  623. name: "24"
  624. }, {
  625. type: "input_dummy"
  626. }, {
  627. colour: "#000000",
  628. type: "field_colour",
  629. name: "30"
  630. }, {
  631. colour: "#000000",
  632. type: "field_colour",
  633. name: "31"
  634. }, {
  635. colour: "#000000",
  636. type: "field_colour",
  637. name: "32"
  638. }, {
  639. colour: "#000000",
  640. type: "field_colour",
  641. name: "33"
  642. }, {
  643. colour: "#000000",
  644. type: "field_colour",
  645. name: "34"
  646. }, {
  647. type: "input_dummy"
  648. }, {
  649. colour: "#000000",
  650. type: "field_colour",
  651. name: "40"
  652. }, {
  653. colour: "#000000",
  654. type: "field_colour",
  655. name: "41"
  656. }, {
  657. colour: "#000000",
  658. type: "field_colour",
  659. name: "42"
  660. }, {
  661. colour: "#000000",
  662. type: "field_colour",
  663. name: "43"
  664. }, {
  665. colour: "#000000",
  666. type: "field_colour",
  667. name: "44"
  668. }],
  669. output: "microbit_image",
  670. helpUrl: Blockly.Msg.MICROBIT_IMAGE_CREATE_HELPURL,
  671. tooltip: Blockly.Msg.MICROBIT_IMAGE_CREATE_TOOLTIP,
  672. message0: Blockly.Msg.MICROBIT_IMAGE_CREATE_MESSAGE0
  673. })
  674. }
  675. };
  676. Blockly.Blocks.microbit_image_create1 = {
  677. init: function () {
  678. this.jsonInit({
  679. colour: 128,
  680. args0: [{
  681. type: "input_dummy"
  682. }, {
  683. name: "row0",
  684. type: "input_value",
  685. check: "String"
  686. }, {
  687. name: "row1",
  688. type: "input_value",
  689. check: "String"
  690. }, {
  691. name: "row2",
  692. type: "input_value",
  693. check: "String"
  694. }, {
  695. name: "row3",
  696. type: "input_value",
  697. check: "String"
  698. }, {
  699. name: "row4",
  700. type: "input_value",
  701. check: "String"
  702. }],
  703. output: "microbit_image",
  704. helpUrl: Blockly.Msg.MICROBIT_IMAGE_CREATE1_HELPURL,
  705. tooltip: Blockly.Msg.MICROBIT_IMAGE_CREATE1_TOOLTIP,
  706. message0: Blockly.Msg.MICROBIT_IMAGE_CREATE1_MESSAGE0
  707. })
  708. }
  709. };
  710. Blockly.Blocks.microbit_image_shift = {
  711. init: function () {
  712. this.jsonInit({
  713. colour: 128,
  714. args0: [{
  715. check: "microbit_image",
  716. type: "input_value",
  717. name: "image"
  718. }, {
  719. name: "shift",
  720. options: [[Blockly.Msg.MICROBIT_IMAGE_SHIFT_LEFT, "LEFT"], [Blockly.Msg.MICROBIT_IMAGE_SHIFT_RIGHT, "RIGHT"], [Blockly.Msg.MICROBIT_IMAGE_SHIFT_UP, "UP"], [Blockly.Msg.MICROBIT_IMAGE_SHIFT_DOWN, "DOWN"]],
  721. type: "field_dropdown"
  722. }, {
  723. check: "Number",
  724. type: "input_value",
  725. name: "pos"
  726. }],
  727. output: "microbit_image",
  728. helpUrl: Blockly.Msg.MICROBIT_IMAGE_SHIFT_HELPURL,
  729. tooltip: Blockly.Msg.MICROBIT_IMAGE_SHIFT_TOOLTIP,
  730. message0: Blockly.Msg.MICROBIT_IMAGE_SHIFT_MESSAGE0
  731. })
  732. }
  733. };
  734. Blockly.Blocks.microbit_microbit_panic = {
  735. init: function () {
  736. this.jsonInit({
  737. colour: 160,
  738. previousStatement: null,
  739. helpUrl: Blockly.Msg.MICROBIT_MICROBIT_PANIC_HELPURL,
  740. tooltip: Blockly.Msg.MICROBIT_MICROBIT_PANIC_TOOLTIP,
  741. message0: Blockly.Msg.MICROBIT_MICROBIT_PANIC_MESSAGE0,
  742. args0: [{
  743. min: 0,
  744. value: 0,
  745. type: "field_number",
  746. max: 255,
  747. name: "code"
  748. }]
  749. })
  750. }
  751. };
  752. Blockly.Blocks.microbit_microbit_reset = {
  753. init: function () {
  754. this.jsonInit({
  755. colour: 160,
  756. previousStatement: null,
  757. helpUrl: Blockly.Msg.MICROBIT_MICROBIT_RESET_HELPURL,
  758. tooltip: Blockly.Msg.MICROBIT_MICROBIT_RESET_TOOLTIP,
  759. message0: Blockly.Msg.MICROBIT_MICROBIT_RESET_MESSAGE0
  760. })
  761. }
  762. };
  763. Blockly.Blocks.microbit_microbit_sleep = {
  764. init: function () {
  765. this.jsonInit({
  766. inputsInline: !0,
  767. nextStatement: null,
  768. previousStatement: null,
  769. colour: 160,
  770. helpUrl: Blockly.Msg.MICROBIT_MICROBIT_SLEEP_HELPURL,
  771. tooltip: Blockly.Msg.MICROBIT_MICROBIT_SLEEP_TOOLTIP,
  772. message0: Blockly.Msg.MICROBIT_MICROBIT_SLEEP_MESSAGE0,
  773. args0: [{
  774. check: "Number",
  775. type: "input_value",
  776. name: "duration"
  777. }]
  778. })
  779. }
  780. };
  781. Blockly.Blocks.microbit_microbit_running_time = {
  782. init: function () {
  783. this.jsonInit({
  784. colour: 160,
  785. output: "Number",
  786. helpUrl: Blockly.Msg.MICROBIT_MICROBIT_RUNNING_TIME_HELPURL,
  787. tooltip: Blockly.Msg.MICROBIT_MICROBIT_RUNNING_TIME_TOOLTIP,
  788. message0: Blockly.Msg.MICROBIT_MICROBIT_RUNNING_TIME_MESSAGE0
  789. })
  790. }
  791. };
  792. Blockly.Blocks.microbit_microbit_temperature = {
  793. init: function () {
  794. this.jsonInit({
  795. colour: 160,
  796. output: "Number",
  797. helpUrl: Blockly.Msg.MICROBIT_MICROBIT_TEMPERATURE_HELPURL,
  798. tooltip: Blockly.Msg.MICROBIT_MICROBIT_TEMPERATURE_TOOLTIP,
  799. message0: Blockly.Msg.MICROBIT_MICROBIT_TEMPERATURE_MESSAGE0
  800. })
  801. }
  802. };
  803. Blockly.Blocks.microbit_music_play_built_in = {
  804. init: function () {
  805. this.jsonInit({
  806. colour: 192,
  807. nextStatement: null,
  808. previousStatement: null,
  809. helpUrl: Blockly.Msg.MICROBIT_MUSIC_PLAY_BUILT_IN_HELPURL,
  810. tooltip: Blockly.Msg.MICROBIT_MUSIC_PLAY_BUILT_IN_TOOLTIP,
  811. message0: Blockly.Msg.MICROBIT_MUSIC_PLAY_BUILT_IN_MESSAGE0,
  812. args0: [{
  813. name: "melody",
  814. options: [["DADADADUM", "DADADADUM"], ["ENTERTAINER", "ENTERTAINER"], ["PRELUDE", "PRELUDE"], ["ODE", "ODE"], ["NYAN", "NYAN"], ["RINGTONE", "RINGTONE"], ["FUNK", "FUNK"], ["BLUES", "BLUES"], ["BIRTHDAY", "BIRTHDAY"], ["WEDDING", "WEDDING"], ["FUNERAL", "FUNERAL"], ["PUNCHLINE", "PUNCHLINE"], ["PYTHON", "PYTHON"], ["BADDY", "BADDY"], ["CHASE", "CHASE"], ["BA_DING", "BA_DING"], ["WAWAWAWAA", "WAWAWAWAA"], ["JUMP_UP", "JUMP_UP"], ["JUMP_DOWN", "JUMP_DOWN"], ["POWER_UP", "POWER_UP"], ["POWER_DOWN", "POWER_DOWN"]],
  815. type: "field_dropdown"
  816. }, {
  817. type: "input_dummy"
  818. }, {
  819. checked: !0,
  820. type: "field_checkbox",
  821. name: "wait"
  822. }, {
  823. type: "input_dummy"
  824. }, {
  825. checked: !1,
  826. type: "field_checkbox",
  827. name: "loop"
  828. }]
  829. })
  830. }
  831. };
  832. Blockly.Blocks.microbit_music_pitch = {
  833. init: function () {
  834. this.jsonInit({
  835. inputsInline: !0,
  836. nextStatement: null,
  837. previousStatement: null,
  838. colour: 192,
  839. helpUrl: Blockly.Msg.MICROBIT_MUSIC_PITCH_HELPURL,
  840. tooltip: Blockly.Msg.MICROBIT_MUSIC_PITCH_TOOLTIP,
  841. message0: Blockly.Msg.MICROBIT_MUSIC_PITCH_MESSAGE0,
  842. args0: [{
  843. check: "Number",
  844. type: "input_value",
  845. name: "pitch"
  846. }, {
  847. type: "input_dummy"
  848. }, {
  849. check: "Number",
  850. type: "input_value",
  851. name: "duration"
  852. }]
  853. })
  854. }
  855. };
  856. Blockly.Blocks.microbit_music_play_list_of_notes = {
  857. init: function () {
  858. this.jsonInit({
  859. colour: 192,
  860. nextStatement: null,
  861. previousStatement: null,
  862. helpUrl: Blockly.Msg.MICROBIT_MUSIC_PLAY_LIST_OF_NOTES_HELPURL,
  863. tooltip: Blockly.Msg.MICROBIT_MUSIC_PLAY_LIST_OF_NOTES_TOOLTIP,
  864. message0: Blockly.Msg.MICROBIT_MUSIC_PLAY_LIST_OF_NOTES_MESSAGE0,
  865. args0: [{
  866. check: "Array",
  867. type: "input_value",
  868. name: "notes"
  869. }, {
  870. checked: !0,
  871. type: "field_checkbox",
  872. name: "wait"
  873. }, {
  874. type: "input_dummy"
  875. }, {
  876. checked: !1,
  877. type: "field_checkbox",
  878. name: "loop"
  879. }]
  880. })
  881. }
  882. };
  883. Blockly.Blocks.microbit_music_reset = {
  884. init: function () {
  885. this.jsonInit({
  886. colour: 192,
  887. nextStatement: null,
  888. previousStatement: null,
  889. helpUrl: Blockly.Msg.MICROBIT_MUSIC_RESET_HELPURL,
  890. tooltip: Blockly.Msg.MICROBIT_MUSIC_RESET_TOOLTIP,
  891. message0: Blockly.Msg.MICROBIT_MUSIC_RESET_MESSAGE0
  892. })
  893. }
  894. };
  895. Blockly.Blocks.microbit_music_stop = {
  896. init: function () {
  897. this.jsonInit({
  898. colour: 192,
  899. nextStatement: null,
  900. previousStatement: null,
  901. helpUrl: Blockly.Msg.MICROBIT_MUSIC_STOP_HELPURL,
  902. tooltip: Blockly.Msg.MICROBIT_MUSIC_STOP_TOOLTIP,
  903. message0: Blockly.Msg.MICROBIT_MUSIC_STOP_MESSAGE0
  904. })
  905. }
  906. };
  907. Blockly.Blocks.microbit_music_set_tempo = {
  908. init: function () {
  909. this.jsonInit({
  910. inputsInline: !0,
  911. nextStatement: null,
  912. previousStatement: null,
  913. colour: 192,
  914. helpUrl: Blockly.Msg.MICROBIT_MUSIC_SET_TEMPO_HELPURL,
  915. tooltip: Blockly.Msg.MICROBIT_MUSIC_SET_TEMPO_TOOLTIP,
  916. message0: Blockly.Msg.MICROBIT_MUSIC_SET_TEMPO_MESSAGE0,
  917. args0: [{
  918. check: "Number",
  919. type: "input_value",
  920. name: "ticks"
  921. }, {
  922. check: "Number",
  923. type: "input_value",
  924. name: "bpm"
  925. }]
  926. })
  927. }
  928. };
  929. Blockly.Blocks.microbit_music_get_tempo = {
  930. init: function () {
  931. this.jsonInit({
  932. colour: 192,
  933. output: "Array",
  934. helpUrl: Blockly.Msg.MICROBIT_MUSIC_GET_TEMPO_HELPURL,
  935. tooltip: Blockly.Msg.MICROBIT_MUSIC_GET_TEMPO_TOOLTIP,
  936. message0: Blockly.Msg.MICROBIT_MUSIC_GET_TEMPO_MESSAGE0
  937. })
  938. }
  939. };
  940. Blockly.Blocks.microbit_neopixel_initialise = {
  941. init: function () {
  942. this.jsonInit({
  943. colour: 224,
  944. args0: [{
  945. name: "pin",
  946. options: [["pin0", "pin0"], ["pin1", "pin1"], ["pin2", "pin2"], ["pin3", "pin3"], ["pin4", "pin4"], ["pin5", "pin5"], ["pin6", "pin6"], ["pin7", "pin7"], ["pin8", "pin8"], ["pin9", "pin9"], ["pin10", "pin10"], ["pin11", "pin11"], ["pin12", "pin12"], ["pin13", "pin13"], ["pin14", "pin14"], ["pin15", "pin15"], ["pin16", "pin16"], ["pin17", "pin17"], ["pin18", "pin18"], ["pin19", "pin19"], ["pin20", "pin20"]],
  947. type: "field_dropdown"
  948. }, {
  949. min: 1,
  950. value: 1,
  951. type: "field_number",
  952. name: "n"
  953. }],
  954. output: "neopixel_object",
  955. helpUrl: Blockly.Msg.MICROBIT_NEOPIXEL_INITIALISE_HELPURL,
  956. tooltip: Blockly.Msg.MICROBIT_NEOPIXEL_INITIALISE_TOOLTIP,
  957. message0: Blockly.Msg.MICROBIT_NEOPIXEL_INITIALISE_MESSAGE0
  958. })
  959. }
  960. };
  961. Blockly.Blocks.microbit_neopixel_clear = {
  962. init: function () {
  963. this.jsonInit({
  964. colour: 224,
  965. nextStatement: null,
  966. previousStatement: null,
  967. helpUrl: Blockly.Msg.MICROBIT_NEOPIXEL_CLEAR_HELPURL,
  968. tooltip: Blockly.Msg.MICROBIT_NEOPIXEL_CLEAR_TOOLTIP,
  969. message0: Blockly.Msg.MICROBIT_NEOPIXEL_CLEAR_MESSAGE0,
  970. args0: [{
  971. check: "neopixel_object",
  972. type: "input_value",
  973. name: "neopixel_object"
  974. }]
  975. })
  976. }
  977. };
  978. Blockly.Blocks.microbit_neopixel_show = {
  979. init: function () {
  980. this.jsonInit({
  981. colour: 224,
  982. nextStatement: null,
  983. previousStatement: null,
  984. helpUrl: Blockly.Msg.MICROBIT_NEOPIXEL_SHOW_HELPURL,
  985. tooltip: Blockly.Msg.MICROBIT_NEOPIXEL_SHOW_TOOLTIP,
  986. message0: Blockly.Msg.MICROBIT_NEOPIXEL_SHOW_MESSAGE0,
  987. args0: [{
  988. check: "neopixel_object",
  989. type: "input_value",
  990. name: "neopixel_object"
  991. }]
  992. })
  993. }
  994. };
  995. Blockly.Blocks.microbit_neopixel_set = {
  996. init: function () {
  997. this.jsonInit({
  998. inputsInline: !1,
  999. nextStatement: null,
  1000. previousStatement: null,
  1001. colour: 224,
  1002. helpUrl: Blockly.Msg.MICROBIT_NEOPIXEL_SET_HELPURL,
  1003. tooltip: Blockly.Msg.MICROBIT_NEOPIXEL_SET_TOOLTIP,
  1004. message0: Blockly.Msg.MICROBIT_NEOPIXEL_SET_MESSAGE0,
  1005. args0: [{
  1006. check: "neopixel_object",
  1007. type: "input_value",
  1008. name: "neopixel_object"
  1009. }, {
  1010. check: "Number",
  1011. type: "input_value",
  1012. name: "pixel"
  1013. }, {
  1014. check: "Number",
  1015. type: "input_value",
  1016. name: "red"
  1017. }, {
  1018. check: "Number",
  1019. type: "input_value",
  1020. name: "green"
  1021. }, {
  1022. check: "Number",
  1023. type: "input_value",
  1024. name: "blue"
  1025. }]
  1026. })
  1027. }
  1028. };
  1029. Blockly.Blocks.microbit_pin_touched = {
  1030. init: function () {
  1031. this.jsonInit({
  1032. colour: 256,
  1033. args0: [{
  1034. name: "pin",
  1035. options: [["0", "0"], ["1", "1"], ["2", "2"]],
  1036. type: "field_dropdown"
  1037. }],
  1038. output: "Boolean",
  1039. helpUrl: Blockly.Msg.MICROBIT_PIN_TOUCHED_HELPURL,
  1040. tooltip: Blockly.Msg.MICROBIT_PIN_TOUCHED_TOOLTIP,
  1041. message0: Blockly.Msg.MICROBIT_PIN_TOUCHED_MESSAGE0
  1042. })
  1043. }
  1044. };
  1045. Blockly.Blocks.microbit_pin_was_pressed = {
  1046. init: function () {
  1047. this.jsonInit({
  1048. colour: 256,
  1049. args0: [{
  1050. name: "pin",
  1051. options: [["0", "0"], ["1", "1"], ["2", "2"]],
  1052. type: "field_dropdown"
  1053. }],
  1054. output: "Boolean",
  1055. helpUrl: Blockly.Msg.MICROBIT_PIN_WAS_PRESSED_HELPURL,
  1056. tooltip: Blockly.Msg.MICROBIT_PIN_WAS_PRESSED_TOOLTIP,
  1057. message0: Blockly.Msg.MICROBIT_PIN_WAS_PRESSED_MESSAGE0
  1058. })
  1059. }
  1060. };
  1061. Blockly.Blocks.microbit_pin_get_presses = {
  1062. init: function () {
  1063. this.jsonInit({
  1064. colour: 256,
  1065. args0: [{
  1066. name: "pin",
  1067. options: [["0", "0"], ["1", "1"], ["2", "2"]],
  1068. type: "field_dropdown"
  1069. }],
  1070. output: "Boolean",
  1071. helpUrl: Blockly.Msg.MICROBIT_PIN_GET_PRESSES_HELPURL,
  1072. tooltip: Blockly.Msg.MICROBIT_PIN_GET_PRESSES_TOOLTIP,
  1073. message0: Blockly.Msg.MICROBIT_PIN_GET_PRESSES_MESSAGE0
  1074. })
  1075. }
  1076. };
  1077. Blockly.Blocks.microbit_pin_read_analog = {
  1078. init: function () {
  1079. this.jsonInit({
  1080. colour: 256,
  1081. args0: [{
  1082. name: "pin",
  1083. type: "input_value",
  1084. check: "Number"
  1085. }],
  1086. output: "Number",
  1087. helpUrl: Blockly.Msg.MICROBIT_PIN_READ_ANALOG_HELPURL,
  1088. tooltip: Blockly.Msg.MICROBIT_PIN_READ_ANALOG_TOOLTIP,
  1089. message0: Blockly.Msg.MICROBIT_PIN_READ_ANALOG_MESSAGE0
  1090. })
  1091. }
  1092. };
  1093. Blockly.Blocks.microbit_pin_write_analog = {
  1094. init: function () {
  1095. this.jsonInit({
  1096. inputsInline: !0,
  1097. colour: 256,
  1098. nextStatement: null,
  1099. previousStatement: null,
  1100. helpUrl: Blockly.Msg.MICROBIT_PIN_WRITE_ANALOG_HELPURL,
  1101. tooltip: Blockly.Msg.MICROBIT_PIN_WRITE_ANALOG_TOOLTIP,
  1102. message0: Blockly.Msg.MICROBIT_PIN_WRITE_ANALOG_MESSAGE0,
  1103. args0: [{
  1104. check: "Number",
  1105. type: "input_value",
  1106. name: "output"
  1107. }, {
  1108. name: "pin",
  1109. type: "input_value",
  1110. check: "Number"
  1111. }]
  1112. })
  1113. }
  1114. };
  1115. Blockly.Blocks.microbit_pin_read_digital = {
  1116. init: function () {
  1117. this.jsonInit({
  1118. colour: 256,
  1119. args0: [{
  1120. name: "pin",
  1121. type: "input_value",
  1122. check: "Number"
  1123. }],
  1124. output: "Boolean",
  1125. helpUrl: Blockly.Msg.MICROBIT_PIN_READ_DIGITAL_HELPURL,
  1126. tooltip: Blockly.Msg.MICROBIT_PIN_READ_DIGITAL_TOOLTIP,
  1127. message0: Blockly.Msg.MICROBIT_PIN_READ_DIGITAL_MESSAGE0
  1128. })
  1129. }
  1130. };
  1131. Blockly.Blocks.microbit_pin_write_digital = {
  1132. init: function () {
  1133. this.jsonInit({
  1134. inputsInline: !0,
  1135. colour: 256,
  1136. nextStatement: null,
  1137. previousStatement: null,
  1138. helpUrl: Blockly.Msg.MICROBIT_PIN_WRITE_DIGITAL_HELPURL,
  1139. tooltip: Blockly.Msg.MICROBIT_PIN_WRITE_DIGITAL_TOOLTIP,
  1140. message0: Blockly.Msg.MICROBIT_PIN_WRITE_DIGITAL_MESSAGE0,
  1141. args0: [{
  1142. check: "Number",
  1143. type: "input_value",
  1144. name: "output"
  1145. }, {
  1146. name: "pin",
  1147. type: "input_value",
  1148. check: "Number"
  1149. }]
  1150. })
  1151. }
  1152. };
  1153. Blockly.Blocks.microbit_pin_set_servo = {
  1154. init: function () {
  1155. this.jsonInit({
  1156. inputsInline: !0,
  1157. colour: 256,
  1158. args0: [{
  1159. name: "pin",
  1160. type: "input_value",
  1161. check: "Number"
  1162. }, {
  1163. name: "degree",
  1164. type: "input_value",
  1165. check: "Number"
  1166. }],
  1167. helpUrl: Blockly.Msg.MICROBIT_PIN_SET_SERVO_HELPURL,
  1168. tooltip: Blockly.Msg.MICROBIT_PIN_SET_SERVO_TOOLTIP,
  1169. message0: Blockly.Msg.MICROBIT_PIN_SET_SERVO_MESSAGE0,
  1170. nextStatement: null,
  1171. previousStatement: null
  1172. })
  1173. }
  1174. };
  1175. Blockly.Blocks.microbit_pin_set_mode = {
  1176. init: function () {
  1177. this.jsonInit({
  1178. inputsInline: !0,
  1179. colour: 256,
  1180. args0: [{
  1181. name: "pin",
  1182. type: "input_value",
  1183. check: "Number"
  1184. }, {
  1185. name: "mode",
  1186. options: [[Blockly.Msg.MICROBIT_PIN_MODE_NO, "NO"], [Blockly.Msg.MICROBIT_PIN_MODE_UP, "UP"], [Blockly.Msg.MICROBIT_PIN_MODE_DOWN, "DOWN"]],
  1187. type: "field_dropdown"
  1188. }],
  1189. helpUrl: Blockly.Msg.MICROBIT_PIN_SET_MODE_HELPURL,
  1190. tooltip: Blockly.Msg.MICROBIT_PIN_SET_MODE_TOOLTIP,
  1191. message0: Blockly.Msg.MICROBIT_PIN_SET_MODE_MESSAGE0,
  1192. nextStatement: null,
  1193. previousStatement: null
  1194. })
  1195. }
  1196. };
  1197. Blockly.Blocks.microbit_radio_on = {
  1198. init: function () {
  1199. this.jsonInit({
  1200. colour: 288,
  1201. nextStatement: null,
  1202. previousStatement: null,
  1203. helpUrl: Blockly.Msg.MICROBIT_RADIO_ON_HELPURL,
  1204. tooltip: Blockly.Msg.MICROBIT_RADIO_ON_TOOLTIP,
  1205. message0: Blockly.Msg.MICROBIT_RADIO_ON_MESSAGE0
  1206. })
  1207. }
  1208. };
  1209. Blockly.Blocks.microbit_radio_off = {
  1210. init: function () {
  1211. this.jsonInit({
  1212. colour: 288,
  1213. nextStatement: null,
  1214. previousStatement: null,
  1215. helpUrl: Blockly.Msg.MICROBIT_RADIO_OFF_HELPURL,
  1216. tooltip: Blockly.Msg.MICROBIT_RADIO_OFF_TOOLTIP,
  1217. message0: Blockly.Msg.MICROBIT_RADIO_OFF_MESSAGE0
  1218. })
  1219. }
  1220. };
  1221. Blockly.Blocks.microbit_radio_config = {
  1222. init: function () {
  1223. this.jsonInit({
  1224. colour: 288,
  1225. nextStatement: null,
  1226. previousStatement: null,
  1227. helpUrl: Blockly.Msg.MICROBIT_RADIO_CONFIG_HELPURL,
  1228. tooltip: Blockly.Msg.MICROBIT_RADIO_CONFIG_TOOLTIP,
  1229. message0: Blockly.Msg.MICROBIT_RADIO_CONFIG_MESSAGE0,
  1230. args0: [{
  1231. min: 4,
  1232. value: 32,
  1233. type: "field_number",
  1234. max: 251,
  1235. name: "length"
  1236. }, {
  1237. type: "input_dummy"
  1238. }, {
  1239. min: 1,
  1240. value: 3,
  1241. type: "field_number",
  1242. max: 32,
  1243. name: "queue"
  1244. }, {
  1245. type: "input_dummy"
  1246. }, {
  1247. min: 0,
  1248. value: 7,
  1249. type: "field_number",
  1250. max: 100,
  1251. name: "channel"
  1252. }, {
  1253. type: "input_dummy"
  1254. }, {
  1255. min: 0,
  1256. value: 0,
  1257. type: "field_number",
  1258. max: 7,
  1259. name: "power"
  1260. }, {
  1261. type: "input_dummy"
  1262. }, {
  1263. text: "0x75626974",
  1264. type: "field_input",
  1265. name: "address"
  1266. }, {
  1267. type: "input_dummy"
  1268. }, {
  1269. min: 0,
  1270. value: 0,
  1271. type: "field_number",
  1272. max: 255,
  1273. name: "group"
  1274. }, {
  1275. type: "input_dummy"
  1276. }, {
  1277. name: "data_rate",
  1278. options: [["1Mbit", "RATE_1MBIT"], ["250Kbit", "RATE_250KBIT"], ["2Mbit", "RATE_2MBIT"]],
  1279. type: "field_dropdown"
  1280. }]
  1281. })
  1282. }
  1283. };
  1284. Blockly.Blocks.microbit_radio_reset = {
  1285. init: function () {
  1286. this.jsonInit({
  1287. colour: 288,
  1288. nextStatement: null,
  1289. previousStatement: null,
  1290. helpUrl: Blockly.Msg.MICROBIT_RADIO_RESET_HELPURL,
  1291. tooltip: Blockly.Msg.MICROBIT_RADIO_RESET_TOOLTIP,
  1292. message0: Blockly.Msg.MICROBIT_RADIO_RESET_MESSAGE0
  1293. })
  1294. }
  1295. };
  1296. Blockly.Blocks.microbit_radio_send_string = {
  1297. init: function () {
  1298. this.jsonInit({
  1299. colour: 288,
  1300. nextStatement: null,
  1301. previousStatement: null,
  1302. helpUrl: Blockly.Msg.MICROBIT_RADIO_SEND_STRING_HELPURL,
  1303. tooltip: Blockly.Msg.MICROBIT_RADIO_SEND_STRING_TOOLTIP,
  1304. message0: Blockly.Msg.MICROBIT_RADIO_SEND_STRING_MESSAGE0,
  1305. args0: [{
  1306. check: "String",
  1307. type: "input_value",
  1308. name: "message"
  1309. }]
  1310. })
  1311. }
  1312. };
  1313. Blockly.Blocks.microbit_radio_send_bytes = {
  1314. init: function () {
  1315. this.jsonInit({
  1316. colour: 288,
  1317. nextStatement: null,
  1318. previousStatement: null,
  1319. helpUrl: Blockly.Msg.MICROBIT_RADIO_SEND_BYTES_HELPURL,
  1320. tooltip: Blockly.Msg.MICROBIT_RADIO_SEND_BYTES_TOOLTIP,
  1321. message0: Blockly.Msg.MICROBIT_RADIO_SEND_BYTES_MESSAGE0,
  1322. args0: [{
  1323. check: "Array",
  1324. type: "input_value",
  1325. name: "message"
  1326. }]
  1327. })
  1328. }
  1329. };
  1330. Blockly.Blocks.microbit_radio_receive = {
  1331. init: function () {
  1332. this.jsonInit({
  1333. colour: 288,
  1334. output: "String",
  1335. helpUrl: Blockly.Msg.MICROBIT_RADIO_RECEIVE_HELPURL,
  1336. tooltip: Blockly.Msg.MICROBIT_RADIO_RECEIVE_TOOLTIP,
  1337. message0: Blockly.Msg.MICROBIT_RADIO_RECEIVE_MESSAGE0
  1338. })
  1339. }
  1340. };
  1341. Blockly.Blocks.microbit_radio_receive_bytes = {
  1342. init: function () {
  1343. this.jsonInit({
  1344. colour: 288,
  1345. output: "Array",
  1346. helpUrl: Blockly.Msg.MICROBIT_RADIO_RECEIVE_BYTES_HELPURL,
  1347. tooltip: Blockly.Msg.MICROBIT_RADIO_RECEIVE_BYTES_TOOLTIP,
  1348. message0: Blockly.Msg.MICROBIT_RADIO_RECEIVE_BYTES_MESSAGE0
  1349. })
  1350. }
  1351. };
  1352. Blockly.Blocks.microbit_speech_say = {
  1353. init: function () {
  1354. this.jsonInit({
  1355. colour: 320,
  1356. nextStatement: null,
  1357. previousStatement: null,
  1358. helpUrl: Blockly.Msg.MICROBIT_SPEECH_SAY_HELPURL,
  1359. tooltip: Blockly.Msg.MICROBIT_SPEECH_SAY_TOOLTIP,
  1360. message0: Blockly.Msg.MICROBIT_SPEECH_SAY_MESSAGE0,
  1361. args0: [{
  1362. check: "String",
  1363. type: "input_value",
  1364. name: "english"
  1365. }]
  1366. })
  1367. }
  1368. };
  1369. Blockly.Blocks.microbit_speech_pronounce = {
  1370. init: function () {
  1371. this.jsonInit({
  1372. colour: 320,
  1373. nextStatement: null,
  1374. previousStatement: null,
  1375. helpUrl: Blockly.Msg.MICROBIT_SPEECH_PRONOUNCE_HELPURL,
  1376. tooltip: Blockly.Msg.MICROBIT_SPEECH_PRONOUNCE_TOOLTIP,
  1377. message0: Blockly.Msg.MICROBIT_SPEECH_PRONOUNCE_MESSAGE0,
  1378. args0: [{
  1379. check: "String",
  1380. type: "input_value",
  1381. name: "phonemes"
  1382. }]
  1383. })
  1384. }
  1385. };
  1386. Blockly.Blocks.microbit_speech_sing = {
  1387. init: function () {
  1388. this.jsonInit({
  1389. colour: 320,
  1390. nextStatement: null,
  1391. previousStatement: null,
  1392. helpUrl: Blockly.Msg.MICROBIT_SPEECH_SING_HELPURL,
  1393. tooltip: Blockly.Msg.MICROBIT_SPEECH_SING_TOOLTIP,
  1394. message0: Blockly.Msg.MICROBIT_SPEECH_SING_MESSAGE0,
  1395. args0: [{
  1396. check: "String",
  1397. type: "input_value",
  1398. name: "song"
  1399. }]
  1400. })
  1401. }
  1402. };
  1403. Blockly.Blocks.microbit_set_music_pin = {
  1404. init: function () {
  1405. this.jsonInit({
  1406. colour: 192,
  1407. nextStatement: null,
  1408. previousStatement: null,
  1409. helpUrl: Blockly.Msg.MICROBIT_SET_MUSIC_PIN_HELPURL,
  1410. tooltip: Blockly.Msg.MICROBIT_SET_MUSIC_PIN_TOOLTIP,
  1411. message0: Blockly.Msg.MICROBIT_SET_MUSIC_PIN_MESSAGE0,
  1412. args0: [{
  1413. name: "pin",
  1414. type: "input_value",
  1415. check: "Number"
  1416. }]
  1417. })
  1418. }
  1419. };
  1420. Blockly.Blocks.microbit_init_i2c = {
  1421. init: function () {
  1422. this.jsonInit({
  1423. colour: 160,
  1424. nextStatement: null,
  1425. previousStatement: null,
  1426. helpUrl: Blockly.Msg.MICROBIT_INIT_I2C_HELPURL,
  1427. tooltip: Blockly.Msg.MICROBIT_INIT_I2C_TOOLTIP,
  1428. message0: Blockly.Msg.MICROBIT_INIT_I2C_MESSAGE0,
  1429. args0: [{
  1430. name: "fqs",
  1431. type: "input_value",
  1432. check: "Number"
  1433. }, {
  1434. name: "sda",
  1435. type: "input_value",
  1436. check: "Number"
  1437. }, {
  1438. name: "scl",
  1439. type: "input_value",
  1440. check: "Number"
  1441. }]
  1442. })
  1443. }
  1444. };
  1445. Blockly.Blocks.microbit_i2c_read = {
  1446. init: function () {
  1447. this.jsonInit({
  1448. colour: 160,
  1449. output: "Array",
  1450. helpUrl: Blockly.Msg.MICROBIT_I2C_READ_HELPURL,
  1451. tooltip: Blockly.Msg.MICROBIT_I2C_READ_TOOLTIP,
  1452. message0: Blockly.Msg.MICROBIT_I2C_READ_MESSAGE0,
  1453. args0: [{
  1454. name: "addr",
  1455. type: "input_value",
  1456. check: "Number"
  1457. }, {
  1458. name: "bytes",
  1459. type: "input_value",
  1460. check: "Number"
  1461. }]
  1462. })
  1463. }
  1464. };
  1465. Blockly.Blocks.microbit_i2c_write = {
  1466. init: function () {
  1467. this.jsonInit({
  1468. colour: 160,
  1469. nextStatement: null,
  1470. previousStatement: null,
  1471. helpUrl: Blockly.Msg.MICROBIT_I2C_WRITE_HELPURL,
  1472. tooltip: Blockly.Msg.MICROBIT_I2C_WRITE_TOOLTIP,
  1473. message0: Blockly.Msg.MICROBIT_I2C_WRITE_MESSAGE0,
  1474. args0: [{
  1475. name: "addr",
  1476. type: "input_value",
  1477. check: "Number"
  1478. }, {
  1479. name: "buf",
  1480. type: "input_value",
  1481. check: "Array"
  1482. }]
  1483. })
  1484. }
  1485. };
  1486. Blockly.Blocks.microbit_convert_bytearray = {
  1487. init: function () {
  1488. this.jsonInit({
  1489. colour: 160,
  1490. output: "Array",
  1491. helpUrl: Blockly.Msg.MICROBIT_CONVERT_BYTEARRAY_HELPURL,
  1492. tooltip: Blockly.Msg.MICROBIT_CONVERT_BYTEARRAY_TOOLTIP,
  1493. message0: Blockly.Msg.MICROBIT_CONVERT_BYTEARRAY_MESSAGE0,
  1494. args0: [{
  1495. name: "arr",
  1496. type: "input_value",
  1497. check: null
  1498. }]
  1499. })
  1500. }
  1501. };
  1502. Blockly.Blocks.microbit_uart_init = {
  1503. init: function () {
  1504. this.jsonInit({
  1505. colour: 160,
  1506. args0: [{
  1507. name: "tx",
  1508. check: "Number",
  1509. type: "input_value"
  1510. }, {
  1511. name: "rx",
  1512. check: "Number",
  1513. type: "input_value"
  1514. }, {
  1515. name: "baudrate",
  1516. check: "Number",
  1517. type: "input_value"
  1518. }],
  1519. nextStatement: null,
  1520. previousStatement: null,
  1521. helpUrl: Blockly.Msg.MICROBIT_UART_INIT_HELPURL,
  1522. tooltip: Blockly.Msg.MICROBIT_UART_INIT_TOOLTIP,
  1523. message0: Blockly.Msg.MICROBIT_UART_INIT_MESSAGE0
  1524. })
  1525. }
  1526. };
  1527. Blockly.Blocks.microbit_uart_any_msg_received = {
  1528. init: function () {
  1529. this.jsonInit({
  1530. colour: 160,
  1531. helpUrl: Blockly.Msg.MICROBIT_UART_ANY_MSG_RECEIVED_HELPURL,
  1532. tooltip: Blockly.Msg.MICROBIT_UART_ANY_MSG_RECEIVED_TOOLTIP,
  1533. message0: Blockly.Msg.MICROBIT_UART_ANY_MSG_RECEIVED_MESSAGE0,
  1534. output: "Boolean"
  1535. })
  1536. }
  1537. };
  1538. Blockly.Blocks.microbit_uart_msg_type = {
  1539. init: function () {
  1540. this.jsonInit({
  1541. colour: 160,
  1542. args0: [{
  1543. name: "type0",
  1544. options: [[Blockly.Msg.MICROBIT_ALL_BYTES, "readall"], [Blockly.Msg.MICROBIT_ALINE_BYTES, "readline"], ["1", "1"], ["2", "2"], ["4", "4"]],
  1545. type: "field_dropdown"
  1546. }],
  1547. helpUrl: "",
  1548. tooltip: "",
  1549. message0: "%1",
  1550. output: ["Number", "String"]
  1551. })
  1552. }
  1553. };
  1554. Blockly.Blocks.microbit_uart_msg_type1 = {
  1555. init: function () {
  1556. this.jsonInit({
  1557. colour: 160,
  1558. args0: [{
  1559. name: "type0",
  1560. options: [[Blockly.Msg.MICROBIT_ALL_BYTES, "readall"], ["1", "1"], ["2", "2"], ["4", "4"]],
  1561. type: "field_dropdown"
  1562. }],
  1563. helpUrl: "",
  1564. tooltip: "",
  1565. message0: "%1",
  1566. output: ["Number", "String"]
  1567. })
  1568. }
  1569. };
  1570. Blockly.Blocks.microbit_uart_read_msg = {
  1571. init: function () {
  1572. this.jsonInit({
  1573. colour: 160,
  1574. args0: [{
  1575. name: "type0",
  1576. type: "input_value"
  1577. }],
  1578. helpUrl: Blockly.Msg.MICROBIT_UART_READ_MSG_HELPURL,
  1579. tooltip: Blockly.Msg.MICROBIT_UART_READ_MSG_TOOLTIP,
  1580. message0: Blockly.Msg.MICROBIT_UART_READ_MSG_MESSAGE0,
  1581. output: ["Number", "String"]
  1582. })
  1583. }
  1584. };
  1585. Blockly.Blocks.microbit_uart_read_msg_to = {
  1586. init: function () {
  1587. this.jsonInit({
  1588. colour: 160,
  1589. args0: [{
  1590. name: "type0",
  1591. type: "input_value"
  1592. }, {
  1593. name: "buf0",
  1594. type: "input_value"
  1595. }],
  1596. helpUrl: Blockly.Msg.MICROBIT_UART_READ_MSG_TO_HELPURL,
  1597. tooltip: Blockly.Msg.MICROBIT_UART_READ_MSG_TO_TOOLTIP,
  1598. message0: Blockly.Msg.MICROBIT_UART_READ_MSG_TO_MESSAGE0,
  1599. inputsInline: !0,
  1600. nextStatement: null,
  1601. previousStatement: null
  1602. })
  1603. }
  1604. };
  1605. Blockly.Blocks.microbit_uart_write_msg = {
  1606. init: function () {
  1607. this.jsonInit({
  1608. colour: 160,
  1609. args0: [{
  1610. type: "input_value",
  1611. name: "msg0",
  1612. check: ["Array", "String"]
  1613. }],
  1614. nextStatement: null,
  1615. previousStatement: null,
  1616. helpUrl: Blockly.Msg.MICROBIT_UART_WRITE_MSG_HELPURL,
  1617. tooltip: Blockly.Msg.MICROBIT_UART_WRITE_MSG_TOOLTIP,
  1618. message0: Blockly.Msg.MICROBIT_UART_WRITE_MSG_MESSAGE0
  1619. })
  1620. }
  1621. };
  1622. Blockly.Blocks.CocoRobo_custom_code = {
  1623. init: function () {
  1624. this.jsonInit({
  1625. inputsInline: !1,
  1626. nextStatement: null,
  1627. previousStatement: null,
  1628. colour: CategoryColors.Text,
  1629. helpUrl: Blockly.Msg.CocoRobo_CUSTOM_CODE_HELPURL,
  1630. tooltip: Blockly.Msg.CocoRobo_CUSTOM_CODE_TOOLTIP,
  1631. message0: Blockly.Msg.CocoRobo_CUSTOM_CODE_MESSAGE0,
  1632. args0: [{
  1633. name: "custom_type",
  1634. options: [[Blockly.Msg.CocoRobo_CUSTOM_TYPE_NORMAL, "normal"], [Blockly.Msg.CocoRobo_CUSTOM_TYPE_IMPORT, "topping"]],
  1635. type: "field_dropdown"
  1636. }, {
  1637. type: "input_dummy"
  1638. }, {
  1639. type: "field_textarea",
  1640. name: "custom_code",
  1641. text: "custom code"
  1642. }]
  1643. })
  1644. }
  1645. };
  1646. Blockly.Blocks.CocoRobo_print_to_chart = {
  1647. init: function () {
  1648. this.setColour(CategoryColors.Math);
  1649. this.itemCount_ = 1;
  1650. this.updateShape_();
  1651. this.setNextStatement(!0);
  1652. this.setPreviousStatement(!0);
  1653. this.setMutator(new Blockly.Mutator(["CocoRobo_print_to_chart_item"]));
  1654. this.setTooltip(Blockly.Msg.CocoRobo_PRINT_TO_CHART_TOOLTIP)
  1655. },
  1656. mutationToDom: function () {
  1657. var a = document.createElement("mutation");
  1658. a.setAttribute("items", this.itemCount_);
  1659. return a
  1660. },
  1661. domToMutation: function (a) {
  1662. this.itemCount_ = parseInt(a.getAttribute("items"), 10);
  1663. this.updateShape_()
  1664. },
  1665. decompose: function (a) {
  1666. var b = a.newBlock("CocoRobo_print_to_chart_container");
  1667. b.initSvg();
  1668. for (var c = b.getInput("STACK").connection, e = 0; e < this.itemCount_; e++) {
  1669. var d = a.newBlock("CocoRobo_print_to_chart_item");
  1670. d.initSvg();
  1671. c.connect(d.previousConnection);
  1672. c = d.nextConnection
  1673. }
  1674. return b
  1675. },
  1676. compose: function (a) {
  1677. var b = a.getInputTargetBlock("STACK");
  1678. for (a = []; b;)
  1679. a.push(b.valueConnection_),
  1680. b = b.nextConnection && b.nextConnection.targetBlock();
  1681. for (b = 0; b < this.itemCount_; b++) {
  1682. var c = this.getInput("ADD" + b).connection.targetConnection;
  1683. c && -1 == a.indexOf(c) && c.disconnect()
  1684. }
  1685. this.itemCount_ = a.length;
  1686. 4 < this.itemCount_ && (this.itemCount_ = 4);
  1687. this.updateShape_();
  1688. for (b = 0; b < this.itemCount_; b++)
  1689. Blockly.Mutator.reconnect(a[b], this, "ADD" + b)
  1690. },
  1691. saveConnections: function (a) {
  1692. a = a.getInputTargetBlock("STACK");
  1693. for (var b = 0; a;) {
  1694. var c = this.getInput("ADD" + b);
  1695. a.valueConnection_ = c && c.connection.targetConnection;
  1696. b++;
  1697. a = a.nextConnection && a.nextConnection.targetBlock()
  1698. }
  1699. },
  1700. updateShape_: function () {
  1701. this.itemCount_ && this.getInput("EMPTY") ? this.removeInput("EMPTY") : this.itemCount_ || this.getInput("EMPTY") || this.appendDummyInput("EMPTY").appendField(Blockly.Msg.CocoRobo_PRINT_TO_CHART_EMPTY_TITLE);
  1702. for (var a = 0; a < this.itemCount_; a++)
  1703. if (!this.getInput("ADD" + a)) {
  1704. var b = this.appendValueInput("ADD" + a);
  1705. 0 == a && b.setCheck("Number").appendField(Blockly.Msg.CocoRobo_PRINT_TO_CHART_INPUT_WITH)
  1706. }
  1707. for (; this.getInput("ADD" + a);)
  1708. this.removeInput("ADD" + a),
  1709. a++
  1710. }
  1711. };
  1712. Blockly.Blocks.CocoRobo_print_to_chart_item = {
  1713. init: function () {
  1714. this.setColour(CategoryColors.Math);
  1715. this.appendDummyInput().appendField(Blockly.Msg.CocoRobo_PRINT_TO_CHART_ITEM_TITLE);
  1716. this.setPreviousStatement(!0);
  1717. this.setNextStatement(!0);
  1718. this.setTooltip(Blockly.Msg.CocoRobo_PRINT_TO_CHART_ITEM_TOOLTIP);
  1719. this.contextMenu = !1
  1720. }
  1721. };
  1722. Blockly.Blocks.CocoRobo_print_to_chart_container = {
  1723. init: function () {
  1724. this.setColour(CategoryColors.Math);
  1725. this.appendDummyInput().appendField(Blockly.Msg.CocoRobo_PRINT_TO_CHART_CONTAINER_TITLE_ADD);
  1726. this.appendStatementInput("STACK");
  1727. this.setTooltip(Blockly.Msg.CocoRobo_PRINT_TO_CHART_CONTAINER_TOOLTIP);
  1728. this.contextMenu = !1
  1729. }
  1730. };
  1731. Blockly.Blocks.CocoRobo_init_chart = {
  1732. init: function () {
  1733. this.setColour(CategoryColors.Math);
  1734. this.itemCount_ = 1;
  1735. this.updateShape_();
  1736. this.setNextStatement(!0);
  1737. this.setPreviousStatement(!0);
  1738. this.setMutator(new Blockly.Mutator(["CocoRobo_init_chart_item"]));
  1739. this.setTooltip(Blockly.Msg.CocoRobo_INIT_CHART_TOOLTIP)
  1740. },
  1741. mutationToDom: function () {
  1742. var a = document.createElement("mutation");
  1743. a.setAttribute("items", this.itemCount_);
  1744. return a
  1745. },
  1746. domToMutation: function (a) {
  1747. this.itemCount_ = parseInt(a.getAttribute("items"), 10);
  1748. this.updateShape_()
  1749. },
  1750. decompose: function (a) {
  1751. var b = a.newBlock("CocoRobo_init_chart_container");
  1752. b.initSvg();
  1753. for (var c = b.getInput("STACK").connection, e = 0; e < this.itemCount_; e++) {
  1754. var d = a.newBlock("CocoRobo_init_chart_item");
  1755. d.initSvg();
  1756. c.connect(d.previousConnection);
  1757. c = d.nextConnection
  1758. }
  1759. return b
  1760. },
  1761. compose: function (a) {
  1762. var b = a.getInputTargetBlock("STACK");
  1763. for (a = []; b;)
  1764. a.push(b.valueConnection_),
  1765. b = b.nextConnection && b.nextConnection.targetBlock();
  1766. for (b = 0; b < this.itemCount_; b++) {
  1767. var c = this.getInput("ADD" + b).connection.targetConnection;
  1768. c && -1 == a.indexOf(c) && c.disconnect()
  1769. }
  1770. this.itemCount_ = a.length;
  1771. 4 < this.itemCount_ && (this.itemCount_ = 4);
  1772. this.updateShape_();
  1773. for (b = 0; b < this.itemCount_; b++)
  1774. Blockly.Mutator.reconnect(a[b], this, "ADD" + b)
  1775. },
  1776. saveConnections: function (a) {
  1777. a = a.getInputTargetBlock("STACK");
  1778. for (var b = 0; a;) {
  1779. var c = this.getInput("ADD" + b);
  1780. a.valueConnection_ = c && c.connection.targetConnection;
  1781. b++;
  1782. a = a.nextConnection && a.nextConnection.targetBlock()
  1783. }
  1784. },
  1785. updateShape_: function () {
  1786. this.itemCount_ && this.getInput("EMPTY") ? this.removeInput("EMPTY") : this.itemCount_ || this.getInput("EMPTY") || this.appendDummyInput("EMPTY").appendField(Blockly.Msg.CocoRobo_INIT_CHART_EMPTY_TITLE);
  1787. for (var a = 0; a < this.itemCount_; a++)
  1788. if (!this.getInput("ADD" + a)) {
  1789. var b = this.appendValueInput("ADD" + a);
  1790. 0 == a && b.setCheck("String").appendField(Blockly.Msg.CocoRobo_INIT_CHART_INPUT_WITH)
  1791. }
  1792. for (; this.getInput("ADD" + a);)
  1793. this.removeInput("ADD" + a),
  1794. a++
  1795. }
  1796. };
  1797. Blockly.Blocks.CocoRobo_init_chart_item = {
  1798. init: function () {
  1799. this.setColour(CategoryColors.Math);
  1800. this.appendDummyInput().appendField(Blockly.Msg.CocoRobo_INIT_CHART_ITEM_TITLE);
  1801. this.setPreviousStatement(!0);
  1802. this.setNextStatement(!0);
  1803. this.setTooltip(Blockly.Msg.CocoRobo_INIT_CHART_ITEM_TOOLTIP);
  1804. this.contextMenu = !1
  1805. }
  1806. };
  1807. Blockly.Blocks.CocoRobo_init_chart_container = {
  1808. init: function () {
  1809. this.setColour(CategoryColors.Math);
  1810. this.appendDummyInput().appendField(Blockly.Msg.CocoRobo_INIT_CHART_CONTAINER_TITLE_ADD);
  1811. this.appendStatementInput("STACK");
  1812. this.setTooltip(Blockly.Msg.CocoRobo_INIT_CHART_CONTAINER_TOOLTIP);
  1813. this.contextMenu = !1
  1814. }
  1815. };
  1816. var labplus_gpi = [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["19", "19"], ["20", "20"]]
  1817. , analogPins = [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["10", "10"]]
  1818. , digitalOutput = [["0", "0"], ["1", "1"]]
  1819. , extendedPins = [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"]]
  1820. , labplus_pin_pair = [["6 \x26 7", "6 \x26 7"], ["8 \x26 9", "8 \x26 9"], ["0 \x26 1", "0 \x26 1"], ["13 \x26 14", "13 \x26 14"], ["15 \x26 16", "15 \x26 16"]]
  1821. , labplus_color = "#336699"
  1822. , bluebitdigital = "#2E8B57"
  1823. , bluebitanalog = "#00008B"
  1824. , bluebiti2c = "#CDAD00";
  1825. Blockly.Blocks.labplus_digital_output = {
  1826. init: function () {
  1827. this.jsonInit({
  1828. colour: 320,
  1829. args0: [{
  1830. name: "outputSt",
  1831. options: digitalOutput,
  1832. type: "field_dropdown"
  1833. }],
  1834. output: "Number",
  1835. message0: "%1"
  1836. })
  1837. }
  1838. };
  1839. Blockly.Blocks.labplus_extended_pins = {
  1840. init: function () {
  1841. this.jsonInit({
  1842. colour: 320,
  1843. args0: [{
  1844. name: "pin",
  1845. options: extendedPins,
  1846. type: "field_dropdown"
  1847. }],
  1848. output: "Number",
  1849. message0: "%1"
  1850. })
  1851. }
  1852. };
  1853. Blockly.Blocks.labplus_labplus_gpi = {
  1854. init: function () {
  1855. this.jsonInit({
  1856. colour: 320,
  1857. args0: [{
  1858. name: "pin",
  1859. options: labplus_gpi,
  1860. type: "field_dropdown"
  1861. }],
  1862. output: "Number",
  1863. message0: "%1"
  1864. })
  1865. }
  1866. };
  1867. Blockly.Blocks.labplus_analog_pins = {
  1868. init: function () {
  1869. this.jsonInit({
  1870. colour: 320,
  1871. args0: [{
  1872. name: "pin",
  1873. options: analogPins,
  1874. type: "field_dropdown"
  1875. }],
  1876. output: "Number",
  1877. message0: "%1"
  1878. })
  1879. }
  1880. };
  1881. Blockly.Blocks.labplus_servo_output = {
  1882. init: function () {
  1883. this.jsonInit({
  1884. colour: 30,
  1885. args0: [{
  1886. name: "num",
  1887. type: "field_number",
  1888. value: 90,
  1889. min: 0,
  1890. max: 180
  1891. }],
  1892. output: "Number",
  1893. message0: "%1"
  1894. })
  1895. }
  1896. };
  1897. Blockly.Blocks.labplus_analog_output = {
  1898. init: function () {
  1899. this.jsonInit({
  1900. colour: 320,
  1901. args0: [{
  1902. name: "num",
  1903. type: "field_number",
  1904. value: 1023,
  1905. min: 0,
  1906. max: 1023
  1907. }],
  1908. output: "Number",
  1909. message0: "%1"
  1910. })
  1911. }
  1912. };
  1913. Blockly.Blocks.labplus_extended_pin_define = {
  1914. init: function () {
  1915. this.jsonInit({
  1916. colour: 320,
  1917. args0: [{
  1918. name: "pin_define",
  1919. options: [[Blockly.Msg.LABPLUS_COMPITITION_INIT_EXTENDED_PINS_INPUT, "0"], [Blockly.Msg.LABPLUS_COMPITITION_INIT_EXTENDED_PINS_OUTPUT, "1"]],
  1920. type: "field_dropdown"
  1921. }],
  1922. output: "Number",
  1923. message0: "%1"
  1924. })
  1925. }
  1926. };
  1927. Blockly.Blocks.labplus_infrared_is_triggered = {
  1928. init: function () {
  1929. this.jsonInit({
  1930. colour: bluebitdigital,
  1931. args0: [{
  1932. name: "pin",
  1933. type: "input_value",
  1934. check: "Number"
  1935. }],
  1936. output: "Boolean",
  1937. message0: Blockly.Msg.LABPLUS_INFRARED_IS_TRIGGERED_MESSAGE0,
  1938. tooltip: Blockly.Msg.LABPLUS_INFRARED_IS_TRIGGERED_TOOLTIP,
  1939. helpUrl: Blockly.Msg.LABPLUS_INFRARED_IS_TRIGGERED_HELPURL
  1940. })
  1941. }
  1942. };
  1943. Blockly.Blocks.labplus_sound_is_triggered = {
  1944. init: function () {
  1945. this.jsonInit({
  1946. colour: bluebitdigital,
  1947. args0: [{
  1948. name: "pin",
  1949. type: "input_value",
  1950. check: "Number"
  1951. }],
  1952. output: "Boolean",
  1953. message0: Blockly.Msg.LABPLUS_SOUND_IS_TRIGGERED_MESSAGE0,
  1954. tooltip: Blockly.Msg.LABPLUS_SOUND_IS_TRIGGERED_TOOLTIP,
  1955. helpUrl: Blockly.Msg.LABPLUS_SOUND_IS_TRIGGERED_HELPURL
  1956. })
  1957. }
  1958. };
  1959. Blockly.Blocks.labplus_human_detector_is_triggered = {
  1960. init: function () {
  1961. this.jsonInit({
  1962. colour: bluebitdigital,
  1963. args0: [{
  1964. name: "pin",
  1965. type: "input_value",
  1966. check: "Number"
  1967. }],
  1968. output: "Boolean",
  1969. message0: Blockly.Msg.LABPLUS_HUMAN_DETECTOR_IS_TRIGGERED_MESSAGE0,
  1970. tooltip: Blockly.Msg.LABPLUS_HUMAN_DETECTOR_IS_TRIGGERED_TOOLTIP,
  1971. helpUrl: Blockly.Msg.LABPLUS_HUMAN_DETECTOR_IS_TRIGGERED_HELPURL
  1972. })
  1973. }
  1974. };
  1975. Blockly.Blocks.labplus_magnetic_switch_is_triggered = {
  1976. init: function () {
  1977. this.jsonInit({
  1978. colour: bluebitdigital,
  1979. args0: [{
  1980. name: "pin",
  1981. type: "input_value",
  1982. check: "Number"
  1983. }],
  1984. output: "Boolean",
  1985. message0: Blockly.Msg.LABPLUS_MAGNETIC_SWITCH_IS_TRIGGERED_MESSAGE0,
  1986. tooltip: Blockly.Msg.LABPLUS_MAGNETIC_SWITCH_IS_TRIGGERED_TOOLTIP,
  1987. helpUrl: Blockly.Msg.LABPLUS_MAGNETIC_SWITCH_IS_TRIGGERED_HELPURL
  1988. })
  1989. }
  1990. };
  1991. Blockly.Blocks.labplus_line_follower_is_triggered = {
  1992. init: function () {
  1993. this.jsonInit({
  1994. colour: bluebitdigital,
  1995. args0: [{
  1996. name: "pin",
  1997. type: "input_value",
  1998. check: "Number"
  1999. }],
  2000. output: "Boolean",
  2001. message0: Blockly.Msg.LABPLUS_LINE_FOLLOWER_IS_TRIGGERED_MESSAGE0,
  2002. tooltip: Blockly.Msg.LABPLUS_LINE_FOLLOWER_IS_TRIGGERED_TOOLTIP,
  2003. helpUrl: Blockly.Msg.LABPLUS_LINE_FOLLOWER_IS_TRIGGERED_HELPURL
  2004. })
  2005. }
  2006. };
  2007. Blockly.Blocks.labplus_shake_detector_is_triggered = {
  2008. init: function () {
  2009. this.jsonInit({
  2010. colour: bluebitdigital,
  2011. args0: [{
  2012. name: "pin",
  2013. type: "input_value",
  2014. check: "Number"
  2015. }],
  2016. output: "Boolean",
  2017. message0: Blockly.Msg.LABPLUS_SHAKE_DETECTOR_IS_TRIGGERED_MESSAGE0,
  2018. tooltip: Blockly.Msg.LABPLUS_SHAKE_DETECTOR_IS_TRIGGERED_TOOLTIP,
  2019. helpUrl: Blockly.Msg.LABPLUS_SHAKE_DETECTOR_IS_TRIGGERED_HELPURL
  2020. })
  2021. }
  2022. };
  2023. Blockly.Blocks.labplus_smoke_detector_is_triggered = {
  2024. init: function () {
  2025. this.jsonInit({
  2026. colour: bluebitdigital,
  2027. args0: [{
  2028. name: "pin",
  2029. type: "input_value",
  2030. check: "Number"
  2031. }],
  2032. output: "Boolean",
  2033. message0: Blockly.Msg.LABPLUS_SMOKE_DETECTOR_IS_TRIGGERED_MESSAGE0,
  2034. tooltip: Blockly.Msg.LABPLUS_SMOKE_DETECTOR_IS_TRIGGERED_TOOLTIP,
  2035. helpUrl: Blockly.Msg.LABPLUS_SMOKE_DETECTOR_IS_TRIGGERED_HELPURL
  2036. })
  2037. }
  2038. };
  2039. Blockly.Blocks.labplus_fingerprint_sensor = {
  2040. init: function () {
  2041. this.jsonInit({
  2042. colour: bluebitdigital,
  2043. args0: [{
  2044. name: "pin",
  2045. type: "input_value",
  2046. check: "Number"
  2047. }],
  2048. output: "Boolean",
  2049. message0: Blockly.Msg.LABPLUS_FINGERPRINT_SENSOR_MESSAGE0,
  2050. tooltip: Blockly.Msg.LABPLUS_FINGERPRINT_SENSOR_TOOLTIP,
  2051. helpUrl: Blockly.Msg.LABPLUS_FINGERPRINT_SENSOR_HELPURL
  2052. })
  2053. }
  2054. };
  2055. Blockly.Blocks.labplus_get_rfid_id = {
  2056. init: function () {
  2057. this.jsonInit({
  2058. colour: bluebitdigital,
  2059. args0: [{
  2060. name: "pin",
  2061. type: "input_value",
  2062. check: "Number"
  2063. }],
  2064. output: "Boolean",
  2065. message0: Blockly.Msg.LABPLUS_GET_RFID_ID_MESSAGE0,
  2066. tooltip: Blockly.Msg.LABPLUS_GET_RFID_ID_TOOLTIP,
  2067. helpUrl: Blockly.Msg.LABPLUS_GET_RFID_ID_HELPURL
  2068. })
  2069. }
  2070. };
  2071. Blockly.Blocks.labplus_button_module_is_pressed = {
  2072. init: function () {
  2073. this.jsonInit({
  2074. colour: bluebitdigital,
  2075. args0: [{
  2076. name: "pin",
  2077. type: "input_value",
  2078. check: "Number"
  2079. }],
  2080. output: "Boolean",
  2081. message0: Blockly.Msg.LABPLUS_BUTTON_MODULE_IS_PRESSED_MESSAGE0,
  2082. tooltip: Blockly.Msg.LABPLUS_BUTTON_MODULE_IS_PRESSED_TOOLTIP,
  2083. helpUrl: Blockly.Msg.LABPLUS_BUTTON_MODULE_IS_PRESSED_HELPURL
  2084. })
  2085. }
  2086. };
  2087. Blockly.Blocks.labplus_heat_sensitive_detector = {
  2088. init: function () {
  2089. this.jsonInit({
  2090. colour: bluebitanalog,
  2091. args0: [{
  2092. name: "pin",
  2093. type: "input_value",
  2094. check: "Number"
  2095. }],
  2096. output: "Number",
  2097. message0: Blockly.Msg.LABPLUS_HEAT_SENSITIVE_DETECTOR_MESSAGE0,
  2098. tooltip: Blockly.Msg.LABPLUS_HEAT_SENSITIVE_DETECTOR_TOOLTIP,
  2099. helpUrl: Blockly.Msg.LABPLUS_HEAT_SENSITIVE_DETECTOR_HELPURL
  2100. })
  2101. }
  2102. };
  2103. Blockly.Blocks.labplus_4button = {
  2104. init: function () {
  2105. this.jsonInit({
  2106. colour: bluebitanalog,
  2107. args0: [{
  2108. name: "pin",
  2109. type: "input_value",
  2110. check: "Number"
  2111. }, {
  2112. name: "button_val",
  2113. type: "field_dropdown",
  2114. options: [[Blockly.Msg.BLUE, "1"], [Blockly.Msg.GREEN, "2"], [Blockly.Msg.RED, "3"], [Blockly.Msg.YELLOW, "4"]]
  2115. }],
  2116. output: "Boolean",
  2117. message0: Blockly.Msg.LABPLUS_4BUTTON_MESSAGE0,
  2118. tooltip: Blockly.Msg.LABPLUS_4BUTTON_TOOLTIP,
  2119. helpUrl: Blockly.Msg.LABPLUS_4BUTTON_HELPURL
  2120. })
  2121. }
  2122. };
  2123. Blockly.Blocks.labplus_temperature_sensor = {
  2124. init: function () {
  2125. this.jsonInit({
  2126. colour: bluebitanalog,
  2127. args0: [{
  2128. name: "pin",
  2129. type: "input_value",
  2130. check: "Number"
  2131. }],
  2132. output: "Number",
  2133. message0: Blockly.Msg.LABPLUS_TEMPERATURE_SENSOR_MESSAGE0,
  2134. tooltip: Blockly.Msg.LABPLUS_TEMPERATURE_SENSOR_TOOLTIP,
  2135. helpUrl: Blockly.Msg.LABPLUS_TEMPERATURE_SENSOR_HELPURL
  2136. })
  2137. }
  2138. };
  2139. Blockly.Blocks.labplus_rotate_dimmer = {
  2140. init: function () {
  2141. this.jsonInit({
  2142. colour: bluebitanalog,
  2143. args0: [{
  2144. name: "pin",
  2145. type: "input_value",
  2146. check: "Number"
  2147. }],
  2148. output: "Number",
  2149. message0: Blockly.Msg.LABPLUS_ROTATE_DIMMER_MESSAGE0,
  2150. tooltip: Blockly.Msg.LABPLUS_ROTATE_DIMMER_TOOLTIP,
  2151. helpUrl: Blockly.Msg.LABPLUS_ROTATE_DIMMER_HELPURL
  2152. })
  2153. }
  2154. };
  2155. Blockly.Blocks.labplus_water_level_detector = {
  2156. init: function () {
  2157. this.jsonInit({
  2158. colour: bluebitanalog,
  2159. args0: [{
  2160. name: "pin",
  2161. type: "input_value",
  2162. check: "Number"
  2163. }],
  2164. output: "Number",
  2165. message0: Blockly.Msg.LABPLUS_WATER_LEVEL_DETECTOR_MESSAGE0,
  2166. tooltip: Blockly.Msg.LABPLUS_WATER_LEVEL_DETECTOR_TOOLTIP,
  2167. helpUrl: Blockly.Msg.LABPLUS_WATER_LEVEL_DETECTOR_HELPURL
  2168. })
  2169. }
  2170. };
  2171. Blockly.Blocks.labplus_sound_level_sensor = {
  2172. init: function () {
  2173. this.jsonInit({
  2174. colour: bluebitanalog,
  2175. args0: [{
  2176. name: "pin",
  2177. type: "input_value",
  2178. check: "Number"
  2179. }],
  2180. output: "Number",
  2181. message0: Blockly.Msg.LABPLUS_SOUND_LEVEL_SENSOR_MESSAGE0,
  2182. tooltip: Blockly.Msg.LABPLUS_SOUND_LEVEL_SENSOR_TOOLTIP,
  2183. helpUrl: Blockly.Msg.LABPLUS_SOUND_LEVEL_SENSOR_HELPURL
  2184. })
  2185. }
  2186. };
  2187. Blockly.Blocks.labplus_smoke_sensor = {
  2188. init: function () {
  2189. this.jsonInit({
  2190. colour: bluebitanalog,
  2191. args0: [{
  2192. name: "pin",
  2193. type: "input_value",
  2194. check: "Number"
  2195. }],
  2196. output: "Number",
  2197. message0: Blockly.Msg.LABPLUS_SMOKE_SENSOR_MESSAGE0,
  2198. tooltip: Blockly.Msg.LABPLUS_SMOKE_SENSOR_TOOLTIP,
  2199. helpUrl: Blockly.Msg.LABPLUS_SMOKE_SENSOR_HELPURL
  2200. })
  2201. }
  2202. };
  2203. Blockly.Blocks.labplus_joystick = {
  2204. init: function () {
  2205. this.jsonInit({
  2206. colour: bluebitanalog,
  2207. args0: [{
  2208. name: "pin",
  2209. type: "input_value",
  2210. check: "Number"
  2211. }, {
  2212. name: "pin1",
  2213. type: "input_value",
  2214. check: "Number"
  2215. }, {
  2216. name: "axis",
  2217. type: "field_dropdown",
  2218. options: [["X", "X"], ["Y", "Y"]]
  2219. }],
  2220. output: "Number",
  2221. message0: Blockly.Msg.LABPLUS_JOYSTICK_MESSAGE0,
  2222. tooltip: Blockly.Msg.LABPLUS_JOYSTICK_TOOLTIP,
  2223. helpUrl: Blockly.Msg.LABPLUS_JOYSTICK_HELPURL
  2224. })
  2225. }
  2226. };
  2227. Blockly.Blocks.labplus_soil_moisture_sensor = {
  2228. init: function () {
  2229. this.jsonInit({
  2230. colour: bluebitanalog,
  2231. args0: [{
  2232. name: "pin",
  2233. type: "input_value",
  2234. check: "Number"
  2235. }],
  2236. output: "Number",
  2237. message0: Blockly.Msg.LABPLUS_SOIL_MOISTURE_SENSOR_MESSAGE0,
  2238. tooltip: Blockly.Msg.LABPLUS_SOIL_MOISTURE_SENSOR_TOOLTIP,
  2239. helpUrl: Blockly.Msg.LABPLUS_SOIL_MOISTURE_SENSOR_HELPURL
  2240. })
  2241. }
  2242. };
  2243. Blockly.Blocks.labplus_light_sensor = {
  2244. init: function () {
  2245. this.jsonInit({
  2246. colour: bluebitanalog,
  2247. args0: [{
  2248. name: "pin",
  2249. type: "input_value",
  2250. check: "Number"
  2251. }],
  2252. output: "Number",
  2253. message0: Blockly.Msg.LABPLUS_LIGHT_SENSOR_MESSAGE0,
  2254. tooltip: Blockly.Msg.LABPLUS_LIGHT_SENSOR_TOOLTIP,
  2255. helpUrl: Blockly.Msg.LABPLUS_LIGHT_SENSOR_HELPURL
  2256. })
  2257. }
  2258. };
  2259. Blockly.Blocks.labplus_i2c_light_sensor = {
  2260. init: function () {
  2261. this.jsonInit({
  2262. colour: bluebiti2c,
  2263. output: "Number",
  2264. message0: Blockly.Msg.LABPLUS_I2C_LIGHT_SENSOR_MESSAGE0,
  2265. tooltip: Blockly.Msg.LABPLUS_I2C_LIGHT_SENSOR_TOOLTIP,
  2266. helpUrl: Blockly.Msg.LABPLUS_I2C_LIGHT_SENSOR_HELPURL
  2267. })
  2268. }
  2269. };
  2270. Blockly.Blocks.labplus_temp_hum_sensor = {
  2271. init: function () {
  2272. this.jsonInit({
  2273. colour: bluebiti2c,
  2274. args0: [{
  2275. name: "opt",
  2276. type: "field_dropdown",
  2277. options: [[Blockly.Msg.LABPLUS_TM_HM_SENSOR_TM, "temperature"], [Blockly.Msg.LABPLUS_TM_HM_SENSOR_HM, "humility"]]
  2278. }],
  2279. output: "Number",
  2280. message0: Blockly.Msg.LABPLUS_TM_HM_SENSOR_MESSAGE0,
  2281. tooltip: Blockly.Msg.LABPLUS_TM_HM_SENSOR_TOOLTIP,
  2282. helpUrl: Blockly.Msg.LABPLUS_TM_HM_SENSOR_HELPURL
  2283. })
  2284. }
  2285. };
  2286. Blockly.Blocks.labplus_read_color_from_i2c = {
  2287. init: function () {
  2288. this.jsonInit({
  2289. colour: bluebiti2c,
  2290. args0: [],
  2291. helpUrl: Blockly.Msg.LABPLUS_READ_COLOR_FROM_I2C_HELPURL,
  2292. tooltip: Blockly.Msg.LABPLUS_READ_COLOR_FROM_I2C_TOOLTIP,
  2293. message0: Blockly.Msg.LABPLUS_READ_COLOR_FROM_I2C_MESSAGE0,
  2294. nextStatement: null,
  2295. previousStatement: null
  2296. })
  2297. }
  2298. };
  2299. Blockly.Blocks.labplus_rgb_color = {
  2300. init: function () {
  2301. this.jsonInit({
  2302. colour: bluebiti2c,
  2303. args0: [{
  2304. name: "color",
  2305. options: [["R", "R"], ["G", "G"], ["B", "B"]],
  2306. type: "field_dropdown"
  2307. }],
  2308. helpUrl: Blockly.Msg.LABPLUS_RGB_COLOR_HELPURL,
  2309. tooltip: Blockly.Msg.LABPLUS_RGB_COLOR_TOOLTIP,
  2310. message0: Blockly.Msg.LABPLUS_RGB_COLOR_MESSAGE0,
  2311. output: "Number"
  2312. })
  2313. }
  2314. };
  2315. Blockly.Blocks.labplus_i2c_ultrasonic = {
  2316. init: function () {
  2317. this.jsonInit({
  2318. colour: bluebiti2c,
  2319. helpUrl: Blockly.Msg.LABPLUS_I2C_ULTRASONIC_HELPURL,
  2320. tooltip: Blockly.Msg.LABPLUS_I2C_ULTRASONIC_TOOLTIP,
  2321. message0: Blockly.Msg.LABPLUS_I2C_ULTRASONIC_MESSAGE0,
  2322. output: "Number"
  2323. })
  2324. }
  2325. };
  2326. Blockly.Blocks.labplus_led = {
  2327. init: function () {
  2328. this.jsonInit({
  2329. colour: bluebitdigital,
  2330. args0: [{
  2331. check: "Number",
  2332. type: "input_value",
  2333. name: "output"
  2334. }, {
  2335. name: "pin",
  2336. type: "input_value",
  2337. check: "Number"
  2338. }],
  2339. helpUrl: Blockly.Msg.LABPLUS_LED_HELPURL,
  2340. tooltip: Blockly.Msg.LABPLUS_LED_TOOLTIP,
  2341. message0: Blockly.Msg.LABPLUS_LED_MESSAGE0,
  2342. nextStatement: null,
  2343. previousStatement: null
  2344. })
  2345. }
  2346. };
  2347. Blockly.Blocks.labplus_fan_switch = {
  2348. init: function () {
  2349. this.jsonInit({
  2350. colour: bluebitdigital,
  2351. nextStatement: null,
  2352. previousStatement: null,
  2353. helpUrl: Blockly.Msg.LABPLUS_FAN_SWITCH_HELPURL,
  2354. tooltip: Blockly.Msg.LABPLUS_FAN_SWITCH_TOOLTIP,
  2355. message0: Blockly.Msg.LABPLUS_FAN_SWITCH_MESSAGE0,
  2356. args0: [{
  2357. type: "field_dropdown",
  2358. options: [[Blockly.Msg.LABPLUS_USB_SWITCH_ON, "1"], [Blockly.Msg.LABPLUS_USB_SWITCH_OFF, "0"]],
  2359. name: "status"
  2360. }, {
  2361. name: "pin",
  2362. type: "input_value",
  2363. check: "Number"
  2364. }]
  2365. })
  2366. }
  2367. };
  2368. Blockly.Blocks.labplus_laser_switch = {
  2369. init: function () {
  2370. this.jsonInit({
  2371. colour: bluebitdigital,
  2372. nextStatement: null,
  2373. previousStatement: null,
  2374. helpUrl: Blockly.Msg.LABPLUS_LASER_SWITCH_HELPURL,
  2375. tooltip: Blockly.Msg.LABPLUS_LASER_SWITCH_TOOLTIP,
  2376. message0: Blockly.Msg.LABPLUS_LASER_SWITCH_MESSAGE0,
  2377. args0: [{
  2378. type: "field_dropdown",
  2379. options: [[Blockly.Msg.LABPLUS_USB_SWITCH_ON, "1"], [Blockly.Msg.LABPLUS_USB_SWITCH_OFF, "0"]],
  2380. name: "status"
  2381. }, {
  2382. name: "pin",
  2383. type: "input_value",
  2384. check: "Number"
  2385. }]
  2386. })
  2387. }
  2388. };
  2389. Blockly.Blocks.labplus_usb_switch = {
  2390. init: function () {
  2391. this.jsonInit({
  2392. colour: bluebitdigital,
  2393. nextStatement: null,
  2394. previousStatement: null,
  2395. helpUrl: Blockly.Msg.LABPLUS_USB_SWITCH_HELPURL,
  2396. tooltip: Blockly.Msg.LABPLUS_USB_SWITCH_TOOLTIP,
  2397. message0: Blockly.Msg.LABPLUS_USB_SWITCH_MESSAGE0,
  2398. args0: [{
  2399. type: "field_dropdown",
  2400. options: [[Blockly.Msg.LABPLUS_USB_SWITCH_ON, "1"], [Blockly.Msg.LABPLUS_USB_SWITCH_OFF, "0"]],
  2401. name: "status"
  2402. }, {
  2403. name: "pin",
  2404. type: "input_value",
  2405. check: "Number"
  2406. }]
  2407. })
  2408. }
  2409. };
  2410. Blockly.Blocks.labplus_voice_record_on1 = {
  2411. init: function () {
  2412. this.jsonInit({
  2413. colour: bluebitdigital,
  2414. args0: [{
  2415. type: "field_dropdown",
  2416. name: "func",
  2417. options: [[Blockly.Msg.LABPLUS_VOICE_RECORD_PLAY, "play"], [Blockly.Msg.LABPLUS_VOICE_RECORD_REC, "rec"]]
  2418. }, {
  2419. type: "input_dummy"
  2420. }, {
  2421. type: "input_value",
  2422. name: "rec",
  2423. check: "Number"
  2424. }, {
  2425. type: "input_value",
  2426. name: "play",
  2427. check: "Number"
  2428. }],
  2429. helpUrl: Blockly.Msg.LABPLUS_VOICE_RECORD_ON1_HELPURL,
  2430. tooltip: Blockly.Msg.LABPLUS_VOICE_RECORD_ON1_TOOLTIP,
  2431. message0: Blockly.Msg.LABPLUS_VOICE_RECORD_ON1_MESSAGE0,
  2432. nextStatement: null,
  2433. previousStatement: null,
  2434. inputsInline: !1
  2435. })
  2436. }
  2437. };
  2438. Blockly.Blocks.labplus_voice_record_off1 = {
  2439. init: function () {
  2440. this.jsonInit({
  2441. colour: bluebitdigital,
  2442. args0: [{
  2443. type: "input_dummy"
  2444. }, {
  2445. name: "rec",
  2446. type: "input_value",
  2447. check: "Number"
  2448. }, {
  2449. name: "play",
  2450. type: "input_value",
  2451. check: "Number"
  2452. }],
  2453. helpUrl: Blockly.Msg.LABPLUS_VOICE_RECORD_OFF1_HELPURL,
  2454. tooltip: Blockly.Msg.LABPLUS_VOICE_RECORD_OFF1_TOOLTIP,
  2455. message0: Blockly.Msg.LABPLUS_VOICE_RECORD_OFF1_MESSAGE0,
  2456. nextStatement: null,
  2457. previousStatement: null
  2458. })
  2459. }
  2460. };
  2461. Blockly.Blocks.labplus_set_servo = {
  2462. init: function () {
  2463. this.jsonInit({
  2464. colour: bluebitdigital,
  2465. args0: [{
  2466. name: "pin",
  2467. type: "input_value",
  2468. check: "Number"
  2469. }, {
  2470. name: "degree",
  2471. type: "input_value",
  2472. check: "Number"
  2473. }],
  2474. helpUrl: Blockly.Msg.LABPLUS_SET_SERVO_HELPURL,
  2475. tooltip: Blockly.Msg.LABPLUS_SET_SERVO_TOOLTIP,
  2476. message0: Blockly.Msg.LABPLUS_SET_SERVO_MESSAGE0,
  2477. nextStatement: null,
  2478. previousStatement: null,
  2479. inputsInline: !1
  2480. })
  2481. }
  2482. };
  2483. Blockly.Blocks.labplus_motor_on1 = {
  2484. init: function () {
  2485. this.jsonInit({
  2486. colour: bluebitdigital,
  2487. args0: [{
  2488. name: "status",
  2489. type: "field_dropdown",
  2490. options: [[Blockly.Msg.LABPLUS_MOTOR_ON_CLOCKWISE, "1"], [Blockly.Msg.LABPLUS_MOTOR_ON_ANTICLOCKWISE, "0"]]
  2491. }, {
  2492. name: "speed",
  2493. type: "input_value",
  2494. check: "Number"
  2495. }, {
  2496. name: "ain1",
  2497. type: "input_value",
  2498. check: "Number"
  2499. }, {
  2500. name: "ain2",
  2501. type: "input_value",
  2502. check: "Number"
  2503. }],
  2504. helpUrl: Blockly.Msg.LABPLUS_MOTOR_ON1_HELPURL,
  2505. tooltip: Blockly.Msg.LABPLUS_MOTOR_ON1_TOOLTIP,
  2506. message0: Blockly.Msg.LABPLUS_MOTOR_ON1_MESSAGE0,
  2507. nextStatement: null,
  2508. previousStatement: null
  2509. })
  2510. }
  2511. };
  2512. Blockly.Blocks.labplus_motor_off1 = {
  2513. init: function () {
  2514. this.jsonInit({
  2515. colour: bluebitdigital,
  2516. args0: [{
  2517. type: "input_dummy"
  2518. }, {
  2519. name: "ain1",
  2520. type: "input_value",
  2521. check: "Number"
  2522. }, {
  2523. name: "ain2",
  2524. type: "input_value",
  2525. check: "Number"
  2526. }],
  2527. helpUrl: Blockly.Msg.LABPLUS_MOTOR_OFF1_HELPURL,
  2528. tooltip: Blockly.Msg.LABPLUS_MOTOR_OFF1_TOOLTIP,
  2529. message0: Blockly.Msg.LABPLUS_MOTOR_OFF1_MESSAGE0,
  2530. nextStatement: null,
  2531. previousStatement: null
  2532. })
  2533. }
  2534. };
  2535. Blockly.Blocks.labplus_set_i2c_digits = {
  2536. init: function () {
  2537. this.jsonInit({
  2538. colour: bluebiti2c,
  2539. args0: [{
  2540. name: "val",
  2541. type: "input_value",
  2542. check: ["Number", "Boolean"]
  2543. }],
  2544. helpUrl: Blockly.Msg.LABPLUS_SET_I2C_DIGITS_HELPURL,
  2545. tooltip: Blockly.Msg.LABPLUS_SET_I2C_DIGITS_TOOLTIP,
  2546. message0: Blockly.Msg.LABPLUS_SET_I2C_DIGITS_MESSAGE0,
  2547. nextStatement: null,
  2548. previousStatement: null
  2549. })
  2550. }
  2551. };
  2552. Blockly.Blocks.labplus_turn_off_i2c_digits = {
  2553. init: function () {
  2554. this.jsonInit({
  2555. colour: bluebiti2c,
  2556. args0: [],
  2557. helpUrl: Blockly.Msg.LABPLUS_TURN_OFF_I2C_DIGITS_HELPURL,
  2558. tooltip: Blockly.Msg.LABPLUS_TURN_OFF_I2C_DIGITS_TOOLTIP,
  2559. message0: Blockly.Msg.LABPLUS_TURN_OFF_I2C_DIGITS_MESSAGE0,
  2560. nextStatement: null,
  2561. previousStatement: null
  2562. })
  2563. }
  2564. };
  2565. Blockly.Blocks.labplus_set_i2c_lcd1602_cursor = {
  2566. init: function () {
  2567. this.jsonInit({
  2568. colour: bluebiti2c,
  2569. args0: [{
  2570. type: "input_dummy"
  2571. }, {
  2572. name: "xaxis",
  2573. type: "input_value",
  2574. check: "Number"
  2575. }, {
  2576. name: "yaxis",
  2577. type: "input_value",
  2578. check: "Number"
  2579. }],
  2580. helpUrl: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_CURSOR_HELPURL,
  2581. tooltip: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_CURSOR_TOOLTIP,
  2582. message0: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_CURSOR_MESSAGE0,
  2583. nextStatement: null,
  2584. previousStatement: null
  2585. })
  2586. }
  2587. };
  2588. Blockly.Blocks.labplus_set_i2c_lcd1602_print = {
  2589. init: function () {
  2590. this.jsonInit({
  2591. colour: bluebiti2c,
  2592. args0: [{
  2593. name: "msg0",
  2594. type: "input_value",
  2595. check: "String"
  2596. }],
  2597. helpUrl: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_PRINT_HELPURL,
  2598. tooltip: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_PRINT_TOOLTIP,
  2599. message0: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_PRINT_MESSAGE0,
  2600. nextStatement: null,
  2601. previousStatement: null
  2602. })
  2603. }
  2604. };
  2605. Blockly.Blocks.labplus_set_i2c_lcd1602_scroll = {
  2606. init: function () {
  2607. this.jsonInit({
  2608. colour: bluebiti2c,
  2609. args0: [{
  2610. type: "field_dropdown",
  2611. name: "dir",
  2612. options: [[Blockly.Msg.LABPLUS_SET_I2C_LCD1602_SCROLL_ALEFT, "aleft"], [Blockly.Msg.LABPLUS_SET_I2C_LCD1602_SCROLL_RIGHTWARD, "rightward"]]
  2613. }],
  2614. helpUrl: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_SCROLL_HELPURL,
  2615. tooltip: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_SCROLL_TOOLTIP,
  2616. message0: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_SCROLL_MESSAGE0,
  2617. nextStatement: null,
  2618. previousStatement: null
  2619. })
  2620. }
  2621. };
  2622. Blockly.Blocks.labplus_set_i2c_lcd1602_clear = {
  2623. init: function () {
  2624. this.jsonInit({
  2625. colour: bluebiti2c,
  2626. helpUrl: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_CLEAR_HELPURL,
  2627. tooltip: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_CLEAR_TOOLTIP,
  2628. message0: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_CLEAR_MESSAGE0,
  2629. nextStatement: null,
  2630. previousStatement: null
  2631. })
  2632. }
  2633. };
  2634. Blockly.Blocks.labplus_set_i2c_lcd1602_state = {
  2635. init: function () {
  2636. this.jsonInit({
  2637. colour: bluebiti2c,
  2638. args0: [{
  2639. type: "field_dropdown",
  2640. name: "action",
  2641. options: [[Blockly.Msg.LABPLUS_SET_I2C_LCD1602_HIDE_CURSOR, "0x0c"], [Blockly.Msg.LABPLUS_SET_I2C_LCD1602_SHOW_CURSOR, "0x0e"], [Blockly.Msg.LABPLUS_SET_I2C_LCD1602_BLINK_CURSOR, "0x0d"], [Blockly.Msg.LABPLUS_SET_I2C_LCD1602_SCROLL_LEFT, "0x18"], [Blockly.Msg.LABPLUS_SET_I2C_LCD1602_SCROLL_RIGHT, "0x1c"], [Blockly.Msg.LABPLUS_SET_I2C_LCD1602_LEFT_TO_RIGHT, "0x06"], [Blockly.Msg.LABPLUS_SET_I2C_LCD1602_RIGHT_TO_LEFT, "0x04"], [Blockly.Msg.LABPLUS_SET_I2C_LCD1602_CURSOR_TO_ORIGIN, "0x02"], [Blockly.Msg.LABPLUS_SET_I2C_LCD1602_CLEAR, "0x01"]]
  2642. }],
  2643. helpUrl: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_STATE_HELPURL,
  2644. tooltip: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_STATE_TOOLTIP,
  2645. message0: Blockly.Msg.LABPLUS_SET_I2C_LCD1602_STATE_MESSAGE0,
  2646. nextStatement: null,
  2647. previousStatement: null
  2648. })
  2649. }
  2650. };
  2651. Blockly.Blocks.labplus_set_i2c_led_matrix2 = {
  2652. init: function () {
  2653. this.jsonInit({
  2654. colour: bluebiti2c,
  2655. args0: [{
  2656. type: "input_dummy"
  2657. }, {
  2658. checked: !1,
  2659. type: "field_checkbox",
  2660. name: "00"
  2661. }, {
  2662. checked: !1,
  2663. type: "field_checkbox",
  2664. name: "01"
  2665. }, {
  2666. checked: !1,
  2667. type: "field_checkbox",
  2668. name: "02"
  2669. }, {
  2670. checked: !1,
  2671. type: "field_checkbox",
  2672. name: "03"
  2673. }, {
  2674. checked: !1,
  2675. type: "field_checkbox",
  2676. name: "04"
  2677. }, {
  2678. checked: !1,
  2679. type: "field_checkbox",
  2680. name: "05"
  2681. }, {
  2682. checked: !1,
  2683. type: "field_checkbox",
  2684. name: "06"
  2685. }, {
  2686. checked: !1,
  2687. type: "field_checkbox",
  2688. name: "07"
  2689. }, {
  2690. type: "input_dummy"
  2691. }, {
  2692. checked: !1,
  2693. type: "field_checkbox",
  2694. name: "10"
  2695. }, {
  2696. checked: !1,
  2697. type: "field_checkbox",
  2698. name: "11"
  2699. }, {
  2700. checked: !1,
  2701. type: "field_checkbox",
  2702. name: "12"
  2703. }, {
  2704. checked: !1,
  2705. type: "field_checkbox",
  2706. name: "13"
  2707. }, {
  2708. checked: !1,
  2709. type: "field_checkbox",
  2710. name: "14"
  2711. }, {
  2712. checked: !1,
  2713. type: "field_checkbox",
  2714. name: "15"
  2715. }, {
  2716. checked: !1,
  2717. type: "field_checkbox",
  2718. name: "16"
  2719. }, {
  2720. checked: !1,
  2721. type: "field_checkbox",
  2722. name: "17"
  2723. }, {
  2724. type: "input_dummy"
  2725. }, {
  2726. checked: !1,
  2727. type: "field_checkbox",
  2728. name: "20"
  2729. }, {
  2730. checked: !1,
  2731. type: "field_checkbox",
  2732. name: "21"
  2733. }, {
  2734. checked: !1,
  2735. type: "field_checkbox",
  2736. name: "22"
  2737. }, {
  2738. checked: !1,
  2739. type: "field_checkbox",
  2740. name: "23"
  2741. }, {
  2742. checked: !1,
  2743. type: "field_checkbox",
  2744. name: "24"
  2745. }, {
  2746. checked: !1,
  2747. type: "field_checkbox",
  2748. name: "25"
  2749. }, {
  2750. checked: !1,
  2751. type: "field_checkbox",
  2752. name: "26"
  2753. }, {
  2754. checked: !1,
  2755. type: "field_checkbox",
  2756. name: "27"
  2757. }, {
  2758. type: "input_dummy"
  2759. }, {
  2760. checked: !1,
  2761. type: "field_checkbox",
  2762. name: "30"
  2763. }, {
  2764. checked: !1,
  2765. type: "field_checkbox",
  2766. name: "31"
  2767. }, {
  2768. checked: !1,
  2769. type: "field_checkbox",
  2770. name: "32"
  2771. }, {
  2772. checked: !1,
  2773. type: "field_checkbox",
  2774. name: "33"
  2775. }, {
  2776. checked: !1,
  2777. type: "field_checkbox",
  2778. name: "34"
  2779. }, {
  2780. checked: !1,
  2781. type: "field_checkbox",
  2782. name: "35"
  2783. }, {
  2784. checked: !1,
  2785. type: "field_checkbox",
  2786. name: "36"
  2787. }, {
  2788. checked: !1,
  2789. type: "field_checkbox",
  2790. name: "37"
  2791. }, {
  2792. type: "input_dummy"
  2793. }, {
  2794. checked: !1,
  2795. type: "field_checkbox",
  2796. name: "40"
  2797. }, {
  2798. checked: !1,
  2799. type: "field_checkbox",
  2800. name: "41"
  2801. }, {
  2802. checked: !1,
  2803. type: "field_checkbox",
  2804. name: "42"
  2805. }, {
  2806. checked: !1,
  2807. type: "field_checkbox",
  2808. name: "43"
  2809. }, {
  2810. checked: !1,
  2811. type: "field_checkbox",
  2812. name: "44"
  2813. }, {
  2814. checked: !1,
  2815. type: "field_checkbox",
  2816. name: "45"
  2817. }, {
  2818. checked: !1,
  2819. type: "field_checkbox",
  2820. name: "46"
  2821. }, {
  2822. checked: !1,
  2823. type: "field_checkbox",
  2824. name: "47"
  2825. }, {
  2826. type: "input_dummy"
  2827. }, {
  2828. checked: !1,
  2829. type: "field_checkbox",
  2830. name: "50"
  2831. }, {
  2832. checked: !1,
  2833. type: "field_checkbox",
  2834. name: "51"
  2835. }, {
  2836. checked: !1,
  2837. type: "field_checkbox",
  2838. name: "52"
  2839. }, {
  2840. checked: !1,
  2841. type: "field_checkbox",
  2842. name: "53"
  2843. }, {
  2844. checked: !1,
  2845. type: "field_checkbox",
  2846. name: "54"
  2847. }, {
  2848. checked: !1,
  2849. type: "field_checkbox",
  2850. name: "55"
  2851. }, {
  2852. checked: !1,
  2853. type: "field_checkbox",
  2854. name: "56"
  2855. }, {
  2856. checked: !1,
  2857. type: "field_checkbox",
  2858. name: "57"
  2859. }, {
  2860. type: "input_dummy"
  2861. }, {
  2862. checked: !1,
  2863. type: "field_checkbox",
  2864. name: "60"
  2865. }, {
  2866. checked: !1,
  2867. type: "field_checkbox",
  2868. name: "61"
  2869. }, {
  2870. checked: !1,
  2871. type: "field_checkbox",
  2872. name: "62"
  2873. }, {
  2874. checked: !1,
  2875. type: "field_checkbox",
  2876. name: "63"
  2877. }, {
  2878. checked: !1,
  2879. type: "field_checkbox",
  2880. name: "64"
  2881. }, {
  2882. checked: !1,
  2883. type: "field_checkbox",
  2884. name: "65"
  2885. }, {
  2886. checked: !1,
  2887. type: "field_checkbox",
  2888. name: "66"
  2889. }, {
  2890. checked: !1,
  2891. type: "field_checkbox",
  2892. name: "67"
  2893. }, {
  2894. type: "input_dummy"
  2895. }, {
  2896. checked: !1,
  2897. type: "field_checkbox",
  2898. name: "70"
  2899. }, {
  2900. checked: !1,
  2901. type: "field_checkbox",
  2902. name: "71"
  2903. }, {
  2904. checked: !1,
  2905. type: "field_checkbox",
  2906. name: "72"
  2907. }, {
  2908. checked: !1,
  2909. type: "field_checkbox",
  2910. name: "73"
  2911. }, {
  2912. checked: !1,
  2913. type: "field_checkbox",
  2914. name: "74"
  2915. }, {
  2916. checked: !1,
  2917. type: "field_checkbox",
  2918. name: "75"
  2919. }, {
  2920. checked: !1,
  2921. type: "field_checkbox",
  2922. name: "76"
  2923. }, {
  2924. checked: !1,
  2925. type: "field_checkbox",
  2926. name: "77"
  2927. }],
  2928. helpUrl: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_HELPURL,
  2929. tooltip: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_TOOLTIP,
  2930. message0: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_MESSAGE2,
  2931. nextStatement: null,
  2932. previousStatement: null
  2933. })
  2934. }
  2935. };
  2936. Blockly.Blocks.labplus_set_i2c_led_matrix = {
  2937. init: function () {
  2938. this.jsonInit({
  2939. colour: bluebiti2c,
  2940. args0: [{
  2941. type: "input_dummy"
  2942. }, {
  2943. type: "input_value",
  2944. name: "row1",
  2945. check: "Number"
  2946. }, {
  2947. type: "input_value",
  2948. name: "row2",
  2949. check: "Number"
  2950. }, {
  2951. type: "input_value",
  2952. name: "row3",
  2953. check: "Number"
  2954. }, {
  2955. type: "input_value",
  2956. name: "row4",
  2957. check: "Number"
  2958. }, {
  2959. type: "input_value",
  2960. name: "row5",
  2961. check: "Number"
  2962. }, {
  2963. type: "input_value",
  2964. name: "row6",
  2965. check: "Number"
  2966. }, {
  2967. type: "input_value",
  2968. name: "row7",
  2969. check: "Number"
  2970. }, {
  2971. type: "input_value",
  2972. name: "row8",
  2973. check: "Number"
  2974. }],
  2975. helpUrl: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_HELPURL,
  2976. tooltip: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_TOOLTIP,
  2977. message0: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_MESSAGE0,
  2978. nextStatement: null,
  2979. previousStatement: null
  2980. })
  2981. }
  2982. };
  2983. Blockly.Blocks.labplus_i2c_led_matrix_side = {
  2984. init: function () {
  2985. this.jsonInit({
  2986. colour: bluebiti2c,
  2987. args0: [{
  2988. name: "side",
  2989. options: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"]],
  2990. type: "field_dropdown"
  2991. }],
  2992. helpUrl: "",
  2993. tooltip: "",
  2994. message0: "%1",
  2995. output: "Number"
  2996. })
  2997. }
  2998. };
  2999. Blockly.Blocks.labplus_set_i2c_led_matrix_draw_pixel = {
  3000. init: function () {
  3001. this.jsonInit({
  3002. colour: bluebiti2c,
  3003. args0: [{
  3004. type: "input_dummy"
  3005. }, {
  3006. type: "input_value",
  3007. name: "x",
  3008. check: "Number"
  3009. }, {
  3010. type: "input_value",
  3011. name: "y",
  3012. check: "Number"
  3013. }],
  3014. helpUrl: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_DRAW_PIXEL_HELPURL,
  3015. tooltip: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_DRAW_PIXEL_TOOLTIP,
  3016. message0: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_DRAW_PIXEL_MESSAGE0,
  3017. nextStatement: null,
  3018. previousStatement: null
  3019. })
  3020. }
  3021. };
  3022. Blockly.Blocks.labplus_set_i2c_led_matrix_show = {
  3023. init: function () {
  3024. this.jsonInit({
  3025. colour: bluebiti2c,
  3026. helpUrl: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_SHOW_HELPURL,
  3027. tooltip: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_SHOW_TOOLTIP,
  3028. message0: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_SHOW_MESSAGE0,
  3029. nextStatement: null,
  3030. previousStatement: null
  3031. })
  3032. }
  3033. };
  3034. Blockly.Blocks.labplus_set_i2c_led_matrix_clear = {
  3035. init: function () {
  3036. this.jsonInit({
  3037. colour: bluebiti2c,
  3038. helpUrl: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_CLEAR_HELPURL,
  3039. tooltip: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_CLEAR_TOOLTIP,
  3040. message0: Blockly.Msg.LABPLUS_SET_I2C_LED_MATRIX_CLEAR_MESSAGE0,
  3041. nextStatement: null,
  3042. previousStatement: null
  3043. })
  3044. }
  3045. };
  3046. Blockly.Blocks.labplus_uart_init_midi = {
  3047. init: function () {
  3048. this.jsonInit({
  3049. colour: bluebitdigital,
  3050. args0: [{
  3051. name: "pin",
  3052. check: "Number",
  3053. type: "input_value"
  3054. }],
  3055. nextStatement: null,
  3056. previousStatement: null,
  3057. helpUrl: Blockly.Msg.LABPLUS_UART_INIT_MIDI_HELPURL,
  3058. tooltip: Blockly.Msg.LABPLUS_UART_INIT_MIDI_TOOLTIP,
  3059. message0: Blockly.Msg.LABPLUS_UART_INIT_MIDI_MESSAGE0
  3060. })
  3061. }
  3062. };
  3063. var melodic = [[Blockly.Msg.JOINT_MIDI_PIANO, "1"], [Blockly.Msg.JOINT_Vibraphone, "12"], [Blockly.Msg.JOINT_MIDI_ORGAN, "17"], [Blockly.Msg.JOINT_Acoustic_Guitar, "25"], [Blockly.Msg.JOINT_Electric_Guitar, "31"], [Blockly.Msg.JOINT_Acoustic_Bass, "33"], [Blockly.Msg.JOINT_Violin, "41"], [Blockly.Msg.JOINT_String_Ensemble, "49"], [Blockly.Msg.JOINT_Trumpet, "57"], [Blockly.Msg.JOINT_Sax, "65"], [Blockly.Msg.JOINT_MIDI_BRIGHTACOUSTICPIANO, "2"], [Blockly.Msg.JOINT_MIDI_ELECTRICGRANDPIANO, "3"], [Blockly.Msg.JOINT_MIDI_HARPSICHORD, "7"], [Blockly.Msg.JOINT_MIDI_Celesta, "9"], [Blockly.Msg.JOINT_MIDI_Glockenspiel, "10"], [Blockly.Msg.JOINT_MIDI_Marimba, "13"], [Blockly.Msg.JOINT_MIDI_Xylophone, "14"], [Blockly.Msg.JOINT_MIDI_TubularBell, "15"], [Blockly.Msg.JOINT_MIDI_Dulcimer, "16"], [Blockly.Msg.JOINT_Lead, "81"], [Blockly.Msg.JOINT_Pad, "89"], [Blockly.Msg.JOINT_Steel_Drums, "115"]];
  3064. Blockly.Blocks.labplus_uart_set_midi_melodic = {
  3065. init: function () {
  3066. this.jsonInit({
  3067. colour: bluebitdigital,
  3068. args0: [{
  3069. name: "melodic",
  3070. options: [[Blockly.Msg.JOINT_MIDI_PIANO, "1"], [Blockly.Msg.JOINT_Vibraphone, "12"], [Blockly.Msg.JOINT_MIDI_ORGAN, "17"], [Blockly.Msg.JOINT_Acoustic_Guitar, "25"], [Blockly.Msg.JOINT_Electric_Guitar, "31"], [Blockly.Msg.JOINT_Acoustic_Bass, "33"], [Blockly.Msg.JOINT_Violin, "41"], [Blockly.Msg.JOINT_String_Ensemble, "49"], [Blockly.Msg.JOINT_Trumpet, "57"], [Blockly.Msg.JOINT_Sax, "65"], [Blockly.Msg.JOINT_MIDI_BRIGHTACOUSTICPIANO, "2"], [Blockly.Msg.JOINT_MIDI_ELECTRICGRANDPIANO, "3"], [Blockly.Msg.JOINT_MIDI_HARPSICHORD, "7"], [Blockly.Msg.JOINT_MIDI_Celesta, "9"], [Blockly.Msg.JOINT_MIDI_Glockenspiel, "10"], [Blockly.Msg.JOINT_MIDI_Marimba, "13"], [Blockly.Msg.JOINT_MIDI_Xylophone, "14"], [Blockly.Msg.JOINT_MIDI_TubularBell, "15"], [Blockly.Msg.JOINT_MIDI_Dulcimer, "16"], [Blockly.Msg.JOINT_Lead, "81"], [Blockly.Msg.JOINT_Pad, "89"], [Blockly.Msg.JOINT_Steel_Drums, "115"]],
  3071. type: "field_dropdown"
  3072. }],
  3073. nextStatement: null,
  3074. previousStatement: null,
  3075. helpUrl: Blockly.Msg.LABPLUS_UART_SET_MIDI_MELODIC_HELPURL,
  3076. tooltip: Blockly.Msg.LABPLUS_UART_SET_MIDI_MELODIC_TOOLTIP,
  3077. message0: Blockly.Msg.LABPLUS_UART_SET_MIDI_MELODIC_MESSAGE0
  3078. })
  3079. }
  3080. };
  3081. Blockly.Blocks.labplus_uart_set_midi_vol = {
  3082. init: function () {
  3083. this.jsonInit({
  3084. colour: bluebitdigital,
  3085. args0: [{
  3086. name: "volume",
  3087. check: "Number",
  3088. type: "input_value"
  3089. }],
  3090. nextStatement: null,
  3091. previousStatement: null,
  3092. helpUrl: Blockly.Msg.LABPLUS_UART_SET_MIDI_VOL_HELPURL,
  3093. tooltip: Blockly.Msg.LABPLUS_UART_SET_MIDI_VOL_TOOLTIP,
  3094. message0: Blockly.Msg.LABPLUS_UART_SET_MIDI_VOL_MESSAGE0
  3095. })
  3096. }
  3097. };
  3098. var note = [[Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Do, "60"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Re, "62"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Mi, "64"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Fa, "65"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Sol, "67"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_La, "69"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Si, "71"]];
  3099. Blockly.Blocks.labplus_play_buzzer_note = {
  3100. init: function () {
  3101. this.jsonInit({
  3102. colour: 192,
  3103. args0: [{
  3104. name: "note",
  3105. check: "Number",
  3106. type: "input_value"
  3107. }],
  3108. nextStatement: null,
  3109. previousStatement: null,
  3110. helpUrl: Blockly.Msg.LABPLUS_PLAY_BUZZER_NOTE_HELPURL,
  3111. tooltip: Blockly.Msg.LABPLUS_PLAY_BUZZER_NOTE_TOOLTIP,
  3112. message0: Blockly.Msg.LABPLUS_PLAY_BUZZER_NOTE_MESSAGE0
  3113. })
  3114. }
  3115. };
  3116. Blockly.Blocks.labplus_uart_play_midi_note = {
  3117. init: function () {
  3118. this.jsonInit({
  3119. colour: bluebitdigital,
  3120. args0: [{
  3121. name: "note",
  3122. options: [[Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Do, "60"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Re, "62"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Mi, "64"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Fa, "65"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Sol, "67"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_La, "69"], [Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_Si, "71"]],
  3123. type: "field_dropdown"
  3124. }, {
  3125. name: "status",
  3126. options: [[Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE, "1"], [Blockly.Msg.LABPLUS_UART_OFF_MIDI_NOTE, "0"]],
  3127. type: "field_dropdown"
  3128. }],
  3129. nextStatement: null,
  3130. previousStatement: null,
  3131. helpUrl: Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_HELPURL,
  3132. tooltip: Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_TOOLTIP,
  3133. message0: Blockly.Msg.LABPLUS_UART_PLAY_MIDI_NOTE_MESSAGE0
  3134. })
  3135. }
  3136. };
  3137. Blockly.Blocks.labplus_uart_mp3_play = {
  3138. init: function () {
  3139. this.jsonInit({
  3140. colour: bluebitdigital,
  3141. args0: [{
  3142. name: "index",
  3143. check: "Number",
  3144. type: "input_value"
  3145. }],
  3146. nextStatement: null,
  3147. previousStatement: null,
  3148. helpUrl: Blockly.Msg.LABPLUS_UART_MP3_PLAY_HELPURL,
  3149. tooltip: Blockly.Msg.LABPLUS_UART_MP3_PLAY_TOOLTIP,
  3150. message0: Blockly.Msg.LABPLUS_UART_MP3_PLAY_MESSAGE0
  3151. })
  3152. }
  3153. };
  3154. Blockly.Blocks.labplus_uart_mp3_set_volume = {
  3155. init: function () {
  3156. this.jsonInit({
  3157. colour: bluebitdigital,
  3158. args0: [{
  3159. name: "vol",
  3160. check: "Number",
  3161. type: "input_value"
  3162. }],
  3163. nextStatement: null,
  3164. previousStatement: null,
  3165. helpUrl: Blockly.Msg.LABPLUS_UART_MP3_SET_VOLUME_HELPURL,
  3166. tooltip: Blockly.Msg.LABPLUS_UART_MP3_SET_VOLUME_TOOLTIP,
  3167. message0: Blockly.Msg.LABPLUS_UART_MP3_SET_VOLUME_MESSAGE0
  3168. })
  3169. }
  3170. };
  3171. Blockly.Blocks.labplus_uart_mp3_set_status = {
  3172. init: function () {
  3173. this.jsonInit({
  3174. colour: bluebitdigital,
  3175. args0: [{
  3176. name: "status",
  3177. type: "field_dropdown",
  3178. options: [[Blockly.Msg.STOP, "STOP"]]
  3179. }],
  3180. nextStatement: null,
  3181. previousStatement: null,
  3182. helpUrl: Blockly.Msg.LABPLUS_UART_MP3_SET_STATUS_HELPURL,
  3183. tooltip: Blockly.Msg.LABPLUS_UART_MP3_SET_STATUS_TOOLTIP,
  3184. message0: Blockly.Msg.LABPLUS_UART_MP3_SET_STATUS_MESSAGE0
  3185. })
  3186. }
  3187. };
  3188. Blockly.Blocks.labplus_uart_init = {
  3189. init: function () {
  3190. this.jsonInit({
  3191. colour: bluebitdigital,
  3192. args0: [{
  3193. name: "tx",
  3194. check: "Number",
  3195. type: "input_value"
  3196. }, {
  3197. name: "rx",
  3198. check: "Number",
  3199. type: "input_value"
  3200. }, {
  3201. name: "baudrate",
  3202. check: "Number",
  3203. type: "input_value"
  3204. }],
  3205. nextStatement: null,
  3206. previousStatement: null,
  3207. helpUrl: Blockly.Msg.LABPLUS_UART_INIT_HELPURL,
  3208. tooltip: Blockly.Msg.LABPLUS_UART_INIT_TOOLTIP,
  3209. message0: Blockly.Msg.LABPLUS_UART_INIT_MESSAGE0
  3210. })
  3211. }
  3212. };
  3213. Blockly.Blocks.labplus_uart_any_msg_received = {
  3214. init: function () {
  3215. this.jsonInit({
  3216. colour: bluebitdigital,
  3217. args0: [{
  3218. name: "status",
  3219. type: "field_dropdown",
  3220. options: [[Blockly.Msg.BLUEBIT_INFRARED_SIGNAL, "2"], [Blockly.Msg.BLUEBIT_BLUEBOOTH, "3"]]
  3221. }],
  3222. helpUrl: Blockly.Msg.LABPLUS_UART_ANY_MSG_RECEIVED_HELPURL,
  3223. tooltip: Blockly.Msg.LABPLUS_UART_ANY_MSG_RECEIVED_TOOLTIP,
  3224. message0: Blockly.Msg.LABPLUS_UART_ANY_MSG_RECEIVED_MESSAGE0,
  3225. output: "Boolean"
  3226. })
  3227. }
  3228. };
  3229. Blockly.Blocks.labplus_uart_read_msg = {
  3230. init: function () {
  3231. this.jsonInit({
  3232. colour: bluebitdigital,
  3233. args0: [{
  3234. name: "status",
  3235. type: "field_dropdown",
  3236. options: [[Blockly.Msg.BLUEBIT_INFRARED_SIGNAL, "2"], [Blockly.Msg.BLUEBIT_BLUEBOOTH, "3"]]
  3237. }],
  3238. helpUrl: Blockly.Msg.LABPLUS_UART_READ_MSG_HELPURL,
  3239. tooltip: Blockly.Msg.LABPLUS_UART_READ_MSG_TOOLTIP,
  3240. message0: Blockly.Msg.LABPLUS_UART_READ_MSG_MESSAGE0,
  3241. output: ["Number", "String"]
  3242. })
  3243. }
  3244. };
  3245. Blockly.Blocks.labplus_uart_write_msg = {
  3246. init: function () {
  3247. this.jsonInit({
  3248. colour: bluebitdigital,
  3249. args0: [{
  3250. name: "status",
  3251. type: "field_dropdown",
  3252. options: [[Blockly.Msg.BLUEBIT_INFRARED_SIGNAL, "2"], [Blockly.Msg.BLUEBIT_BLUEBOOTH, "3"]]
  3253. }, {
  3254. type: "input_value",
  3255. name: "msg0",
  3256. check: ["Array", "String"]
  3257. }],
  3258. nextStatement: null,
  3259. previousStatement: null,
  3260. helpUrl: Blockly.Msg.LABPLUS_UART_WRITE_MSG_HELPURL,
  3261. tooltip: Blockly.Msg.LABPLUS_UART_WRITE_MSG_TOOLTIP,
  3262. message0: Blockly.Msg.LABPLUS_UART_WRITE_MSG_MESSAGE0
  3263. })
  3264. }
  3265. };
  3266. Blockly.Blocks.labplus_uart_set_oled = {
  3267. init: function () {
  3268. this.jsonInit({
  3269. colour: bluebitdigital,
  3270. args0: [{
  3271. type: "input_dummy"
  3272. }, {
  3273. type: "input_value",
  3274. name: "x1",
  3275. check: "Number"
  3276. }, {
  3277. type: "input_value",
  3278. name: "y1",
  3279. check: "Number"
  3280. }, {
  3281. type: "input_value",
  3282. name: "msg0",
  3283. check: "String"
  3284. }, {
  3285. type: "field_dropdown",
  3286. name: "font",
  3287. options: [["Font 5x7", "0"], ["\u5b8b\u4f53 16x16", "1"], ["\u5b8b\u4f53 24x24", "2"], ["Consolas 32x32", "4"]]
  3288. }],
  3289. nextStatement: null,
  3290. previousStatement: null,
  3291. helpUrl: Blockly.Msg.LABPLUS_UART_SET_OLCD_HELPURL,
  3292. tooltip: Blockly.Msg.LABPLUS_UART_SET_OLCD_TOOLTIP,
  3293. message0: Blockly.Msg.LABPLUS_UART_SET_OLCD_MESSAGE0,
  3294. inputsInline: !1
  3295. })
  3296. }
  3297. };
  3298. Blockly.Blocks.labplus_uart_set_lcd_clear = {
  3299. init: function () {
  3300. this.jsonInit({
  3301. colour: bluebitdigital,
  3302. args0: [{
  3303. type: "input_dummy"
  3304. }, {
  3305. type: "input_value",
  3306. name: "x1",
  3307. check: "Number"
  3308. }, {
  3309. type: "input_value",
  3310. name: "y1",
  3311. check: "Number"
  3312. }, {
  3313. type: "input_value",
  3314. name: "x2",
  3315. check: "Number"
  3316. }, {
  3317. type: "input_value",
  3318. name: "y2",
  3319. check: "Number"
  3320. }],
  3321. nextStatement: null,
  3322. previousStatement: null,
  3323. helpUrl: Blockly.Msg.LABPLUS_UART_SET_OLCD_CLEAR_HELPURL,
  3324. tooltip: Blockly.Msg.LABPLUS_UART_SET_OLCD_CLEAR_TOOLTIP,
  3325. message0: Blockly.Msg.LABPLUS_UART_SET_OLCD_CLEAR_MESSAGE0,
  3326. inputsInline: !1
  3327. })
  3328. }
  3329. };
  3330. Blockly.Blocks.labplus_uart_set_lcd_clear_all = {
  3331. init: function () {
  3332. this.jsonInit({
  3333. colour: bluebitdigital,
  3334. nextStatement: null,
  3335. previousStatement: null,
  3336. helpUrl: Blockly.Msg.LABPLUS_UART_SET_OLCD_CLEAR_ALL_HELPURL,
  3337. tooltip: Blockly.Msg.LABPLUS_UART_SET_OLCD_CLEAR_ALL_TOOLTIP,
  3338. message0: Blockly.Msg.LABPLUS_UART_SET_OLCD_CLEAR_ALL_MESSAGE0,
  3339. inputsInline: !1
  3340. })
  3341. }
  3342. };
  3343. Blockly.Blocks.labplus_compitition_init_extended_pins = {
  3344. init: function () {
  3345. this.jsonInit({
  3346. colour: bluebiti2c,
  3347. args0: [{
  3348. name: "extendedPins",
  3349. options: extendedPins,
  3350. type: "field_dropdown"
  3351. }, {
  3352. name: "PinMode",
  3353. options: [[Blockly.Msg.LABPLUS_COMPITITION_INIT_EXTENDED_PINS_INPUT, "1"], [Blockly.Msg.LABPLUS_COMPITITION_INIT_EXTENDED_PINS_OUTPUT, "0"]],
  3354. type: "field_dropdown"
  3355. }],
  3356. nextStatement: null,
  3357. previousStatement: null,
  3358. helpUrl: Blockly.Msg.LABPLUS_COMPITITION_INIT_EXTENDED_PINS_HELPURL,
  3359. tooltip: Blockly.Msg.LABPLUS_COMPITITION_INIT_EXTENDED_PINS_TOOLTIP,
  3360. message0: Blockly.Msg.LABPLUS_COMPITITION_INIT_EXTENDED_PINS_MESSAGE0
  3361. })
  3362. }
  3363. };
  3364. Blockly.Blocks.labplus_set_extio_mode = {
  3365. init: function () {
  3366. this.jsonInit({
  3367. colour: bluebiti2c,
  3368. args0: [{
  3369. type: "input_dummy"
  3370. }, {
  3371. name: "mode0",
  3372. options: [[Blockly.Msg.LABPLUS_SET_EXTIO_MODE_INPUT, "1"], [Blockly.Msg.LABPLUS_SET_EXTIO_MODE_OUTPUT, "0"]],
  3373. type: "field_dropdown"
  3374. }, {
  3375. type: "input_dummy"
  3376. }, {
  3377. name: "mode1",
  3378. options: [[Blockly.Msg.LABPLUS_SET_EXTIO_MODE_INPUT, "1"], [Blockly.Msg.LABPLUS_SET_EXTIO_MODE_OUTPUT, "0"]],
  3379. type: "field_dropdown"
  3380. }, {
  3381. type: "input_dummy"
  3382. }, {
  3383. name: "mode2",
  3384. options: [[Blockly.Msg.LABPLUS_SET_EXTIO_MODE_INPUT, "1"], [Blockly.Msg.LABPLUS_SET_EXTIO_MODE_OUTPUT, "0"]],
  3385. type: "field_dropdown"
  3386. }, {
  3387. type: "input_dummy"
  3388. }, {
  3389. name: "mode3",
  3390. options: [[Blockly.Msg.LABPLUS_SET_EXTIO_MODE_INPUT, "1"], [Blockly.Msg.LABPLUS_SET_EXTIO_MODE_OUTPUT, "0"]],
  3391. type: "field_dropdown"
  3392. }, {
  3393. type: "input_dummy"
  3394. }, {
  3395. name: "mode4",
  3396. options: [[Blockly.Msg.LABPLUS_SET_EXTIO_MODE_INPUT, "1"], [Blockly.Msg.LABPLUS_SET_EXTIO_MODE_OUTPUT, "0"]],
  3397. type: "field_dropdown"
  3398. }, {
  3399. type: "input_dummy"
  3400. }, {
  3401. name: "mode5",
  3402. options: [[Blockly.Msg.LABPLUS_SET_EXTIO_MODE_INPUT, "1"], [Blockly.Msg.LABPLUS_SET_EXTIO_MODE_OUTPUT, "0"]],
  3403. type: "field_dropdown"
  3404. }, {
  3405. type: "input_dummy"
  3406. }, {
  3407. name: "mode6",
  3408. options: [[Blockly.Msg.LABPLUS_SET_EXTIO_MODE_INPUT, "1"], [Blockly.Msg.LABPLUS_SET_EXTIO_MODE_OUTPUT, "0"]],
  3409. type: "field_dropdown"
  3410. }, {
  3411. type: "input_dummy"
  3412. }, {
  3413. name: "mode7",
  3414. options: [[Blockly.Msg.LABPLUS_SET_EXTIO_MODE_INPUT, "1"], [Blockly.Msg.LABPLUS_SET_EXTIO_MODE_OUTPUT, "0"]],
  3415. type: "field_dropdown"
  3416. }],
  3417. nextStatement: null,
  3418. previousStatement: null,
  3419. helpUrl: Blockly.Msg.LABPLUS_SET_EXTIO_MODE_HELPURL,
  3420. tooltip: Blockly.Msg.LABPLUS_SET_EXTIO_MODE_TOOLTIP,
  3421. message0: Blockly.Msg.LABPLUS_SET_EXTIO_MODE_MESSAGE0
  3422. })
  3423. }
  3424. };
  3425. Blockly.Blocks.labplus_read_extended_pin = {
  3426. init: function () {
  3427. this.jsonInit({
  3428. colour: bluebiti2c,
  3429. args0: [{
  3430. name: "extendedPins",
  3431. options: extendedPins,
  3432. type: "field_dropdown"
  3433. }],
  3434. output: "Number",
  3435. helpUrl: Blockly.Msg.LABPLUS_READ_EXTENDED_PIN_HELPURL,
  3436. tooltip: Blockly.Msg.LABPLUS_READ_EXTENDED_PIN_TOOLTIP,
  3437. message0: Blockly.Msg.LABPLUS_READ_EXTENDED_PIN_MESSAGE0
  3438. })
  3439. }
  3440. };
  3441. Blockly.Blocks.labplus_write_extended_pin = {
  3442. init: function () {
  3443. this.jsonInit({
  3444. colour: bluebiti2c,
  3445. args0: [{
  3446. name: "extendedPins",
  3447. options: extendedPins,
  3448. type: "field_dropdown"
  3449. }, {
  3450. type: "input_value",
  3451. name: "PinValue",
  3452. check: "Number"
  3453. }],
  3454. nextStatement: null,
  3455. previousStatement: null,
  3456. helpUrl: Blockly.Msg.LABPLUS_WRITE_EXTENDED_PIN_HELPURL,
  3457. tooltip: Blockly.Msg.LABPLUS_WRITE_EXTENDED_PIN_TOOLTIP,
  3458. message0: Blockly.Msg.LABPLUS_WRITE_EXTENDED_PIN_MESSAGE0
  3459. })
  3460. }
  3461. };
  3462. Blockly.Blocks.labplus_mapping = {
  3463. init: function () {
  3464. this.jsonInit({
  3465. colour: 230,
  3466. args0: [{
  3467. name: "inputNum",
  3468. type: "input_value",
  3469. check: "Number"
  3470. }, {
  3471. name: "bMin",
  3472. type: "input_value",
  3473. check: "Number"
  3474. }, {
  3475. name: "bMax",
  3476. type: "input_value",
  3477. check: "Number"
  3478. }, {
  3479. name: "cMin",
  3480. type: "input_value",
  3481. check: "Number"
  3482. }, {
  3483. name: "cMax",
  3484. type: "input_value",
  3485. check: "Number"
  3486. }],
  3487. output: "Number",
  3488. message0: Blockly.Msg.labplus_mapping_MESSAGE0,
  3489. tooltip: Blockly.Msg.labplus_mapping_TOOLTIP,
  3490. helpUrl: Blockly.Msg.labplus_mapping_HELPURL
  3491. })
  3492. }
  3493. };
  3494. Blockly.Blocks.labplus_voice_record_on = {
  3495. init: function () {
  3496. this.jsonInit({
  3497. colour: 30,
  3498. args0: [{
  3499. name: "func",
  3500. type: "field_dropdown",
  3501. options: [[Blockly.Msg.LABPLUS_VOICE_RECORD_PLAY, "play"], [Blockly.Msg.LABPLUS_VOICE_RECORD_REC, "rec"]]
  3502. }, {
  3503. name: "pinpair",
  3504. type: "field_dropdown",
  3505. options: labplus_pin_pair
  3506. }],
  3507. helpUrl: Blockly.Msg.LABPLUS_VOICE_RECORD_ON_HELPURL,
  3508. tooltip: Blockly.Msg.LABPLUS_VOICE_RECORD_ON_TOOLTIP,
  3509. message0: Blockly.Msg.LABPLUS_VOICE_RECORD_ON_MESSAGE0,
  3510. nextStatement: null,
  3511. previousStatement: null
  3512. })
  3513. }
  3514. };
  3515. Blockly.Blocks.labplus_voice_record_off = {
  3516. init: function () {
  3517. this.jsonInit({
  3518. colour: 30,
  3519. args0: [{
  3520. name: "pinpair",
  3521. type: "field_dropdown",
  3522. options: labplus_pin_pair
  3523. }],
  3524. helpUrl: Blockly.Msg.LABPLUS_VOICE_RECORD_OFF_HELPURL,
  3525. tooltip: Blockly.Msg.LABPLUS_VOICE_RECORD_OFF_TOOLTIP,
  3526. message0: Blockly.Msg.LABPLUS_VOICE_RECORD_OFF_MESSAGE0,
  3527. nextStatement: null,
  3528. previousStatement: null
  3529. })
  3530. }
  3531. };
  3532. Blockly.Blocks.labplus_motor_on = {
  3533. init: function () {
  3534. this.jsonInit({
  3535. colour: 30,
  3536. args0: [{
  3537. name: "status",
  3538. type: "field_dropdown",
  3539. options: [[Blockly.Msg.LABPLUS_MOTOR_ON_CLOCKWISE, "1"], [Blockly.Msg.LABPLUS_MOTOR_ON_ANTICLOCKWISE, "0"]]
  3540. }, {
  3541. name: "speed",
  3542. type: "input_value",
  3543. check: "Number"
  3544. }, {
  3545. name: "pinpair",
  3546. type: "field_dropdown",
  3547. options: labplus_pin_pair
  3548. }],
  3549. helpUrl: Blockly.Msg.LABPLUS_MOTOR_ON_HELPURL,
  3550. tooltip: Blockly.Msg.LABPLUS_MOTOR_ON_TOOLTIP,
  3551. message0: Blockly.Msg.LABPLUS_MOTOR_ON_MESSAGE0,
  3552. nextStatement: null,
  3553. previousStatement: null
  3554. })
  3555. }
  3556. };
  3557. Blockly.Blocks.labplus_motor_off = {
  3558. init: function () {
  3559. this.jsonInit({
  3560. colour: 30,
  3561. args0: [{
  3562. name: "pinpair",
  3563. type: "field_dropdown",
  3564. options: labplus_pin_pair
  3565. }],
  3566. helpUrl: Blockly.Msg.LABPLUS_MOTOR_OFF_HELPURL,
  3567. tooltip: Blockly.Msg.LABPLUS_MOTOR_OFF_TOOLTIP,
  3568. message0: Blockly.Msg.LABPLUS_MOTOR_OFF_MESSAGE0,
  3569. nextStatement: null,
  3570. previousStatement: null
  3571. })
  3572. }
  3573. };
  3574. var microbit_ext2_color = "#c90370";
  3575. Blockly.Blocks.microbit_ext2_set_servo = {
  3576. init: function () {
  3577. this.jsonInit({
  3578. colour: microbit_ext2_color,
  3579. args0: [{
  3580. name: "servo",
  3581. type: "field_dropdown",
  3582. options: [["S1", "1"], ["S2", "2"], ["S3", "3"], ["S4", "4"]]
  3583. }, {
  3584. name: "degree",
  3585. type: "input_value",
  3586. check: "Number"
  3587. }],
  3588. nextStatement: null,
  3589. previousStatement: null,
  3590. message0: Blockly.Msg.MICROBIT_EXT2_SET_SERVO_MESSAGE0,
  3591. tooltip: Blockly.Msg.MICROBIT_EXT2_SET_SERVO_TOOLTIP,
  3592. helpUrl: Blockly.Msg.MICROBIT_EXT2_SET_SERVO_HELPURL
  3593. })
  3594. }
  3595. };
  3596. Blockly.Blocks.microbit_ext2_set_motor = {
  3597. init: function () {
  3598. this.jsonInit({
  3599. colour: microbit_ext2_color,
  3600. args0: [{
  3601. name: "motor",
  3602. type: "field_dropdown",
  3603. options: [["M1", "1"], ["M2", "2"], ["M3", "3"], ["M4", "4"]]
  3604. }, {
  3605. name: "dir",
  3606. type: "field_dropdown",
  3607. options: [[Blockly.Msg.LABPLUS_MOTOR_ON_CLOCKWISE, "0"], [Blockly.Msg.LABPLUS_MOTOR_ON_ANTICLOCKWISE, "1"]]
  3608. }, {
  3609. name: "spd",
  3610. type: "input_value",
  3611. check: "Number"
  3612. }],
  3613. message0: Blockly.Msg.MICROBIT_EXT2_SET_MOTOR_MESSAGE0,
  3614. tooltip: Blockly.Msg.MICROBIT_EXT2_SET_MOTOR_TOOLTIP,
  3615. helpUrl: Blockly.Msg.MICROBIT_EXT2_SET_MOTOR_HELPURL,
  3616. nextStatement: null,
  3617. previousStatement: null
  3618. })
  3619. }
  3620. };
  3621. Blockly.Blocks.microbit_ext2_stop_motor = {
  3622. init: function () {
  3623. this.jsonInit({
  3624. colour: microbit_ext2_color,
  3625. args0: [{
  3626. name: "motor",
  3627. type: "field_dropdown",
  3628. options: [["M1", "1"], ["M2", "2"], ["M3", "3"], ["M4", "4"]]
  3629. }],
  3630. message0: Blockly.Msg.MICROBIT_EXT2_STOP_MOTOR_MESSAGE0,
  3631. tooltip: Blockly.Msg.MICROBIT_EXT2_STOP_MOTOR_TOOLTIP,
  3632. helpUrl: Blockly.Msg.MICROBIT_EXT2_STOP_MOTOR_HELPURL,
  3633. nextStatement: null,
  3634. previousStatement: null
  3635. })
  3636. }
  3637. };
  3638. Blockly.Blocks.microbit_ext2_set_pwm = {
  3639. init: function () {
  3640. this.jsonInit({
  3641. colour: microbit_ext2_color,
  3642. args0: [{
  3643. name: "channel",
  3644. type: "field_dropdown",
  3645. options: [["S1", "1"], ["S2", "2"], ["S3", "3"], ["S4", "4"]]
  3646. }, {
  3647. name: "pwm",
  3648. type: "input_value",
  3649. check: "Number"
  3650. }],
  3651. nextStatement: null,
  3652. previousStatement: null,
  3653. message0: Blockly.Msg.MICROBIT_EXT2_SET_PWM_MESSAGE0,
  3654. tooltip: Blockly.Msg.MICROBIT_EXT2_SET_PWM_TOOLTIP,
  3655. helpUrl: Blockly.Msg.MICROBIT_EXT2_SET_PWM_HELPURL
  3656. })
  3657. }
  3658. };
  3659. Blockly.Blocks.microbit_ext2_step_motor = {
  3660. init: function () {
  3661. this.jsonInit({
  3662. colour: microbit_ext2_color,
  3663. args0: [{
  3664. name: "motor",
  3665. type: "field_dropdown",
  3666. options: [["1", "1"], ["2", "2"]]
  3667. }, {
  3668. name: "dir",
  3669. type: "field_dropdown",
  3670. options: [[Blockly.Msg.LABPLUS_SET_MOTOR_CLOCKWISE, "1"], [Blockly.Msg.LABPLUS_SET_MOTOR_ANTI_CLOCKWISE, "0"]]
  3671. }, {
  3672. name: "speed",
  3673. type: "input_value",
  3674. check: "Number"
  3675. }],
  3676. nextStatement: null,
  3677. previousStatement: null,
  3678. message0: Blockly.Msg.MICROBIT_EXT2_STEP_MOTOR_MESSAGE0,
  3679. tooltip: Blockly.Msg.MICROBIT_EXT2_STEP_MOTOR_TOOLTIP,
  3680. helpUrl: Blockly.Msg.MICROBIT_EXT2_STEP_MOTOR_HELPURL
  3681. })
  3682. }
  3683. };
  3684. Blockly.Blocks.microbit_ext2_sound_value = {
  3685. init: function () {
  3686. this.jsonInit({
  3687. colour: microbit_ext2_color,
  3688. output: "Number",
  3689. message0: Blockly.Msg.MICROBIT_EXT2_SOUND_VALUE_MESSAGE0,
  3690. tooltip: Blockly.Msg.MICROBIT_EXT2_SOUND_VALUE_TOOLTIP,
  3691. helpUrl: Blockly.Msg.MICROBIT_EXT2_SOUND_VALUE_HELPURL
  3692. })
  3693. }
  3694. };
  3695. Blockly.Blocks.microbit_ext2_light_value = {
  3696. init: function () {
  3697. this.jsonInit({
  3698. colour: microbit_ext2_color,
  3699. output: "Number",
  3700. message0: Blockly.Msg.MICROBIT_EXT2_LIGHT_VALUE_MESSAGE0,
  3701. tooltip: Blockly.Msg.MICROBIT_EXT2_LIGHT_VALUE_TOOLTIP,
  3702. helpUrl: Blockly.Msg.MICROBIT_EXT2_LIGHT_VALUE_HELPURL
  3703. })
  3704. }
  3705. };
  3706. Blockly.Blocks.botbit_setHSV = {
  3707. init: function () {
  3708. this.jsonInit({
  3709. inputsInline: !0,
  3710. nextStatement: null,
  3711. previousStatement: null,
  3712. colour: 30,
  3713. helpUrl: Blockly.Msg.BOTBIT_setHSV_HELPURL,
  3714. tooltip: Blockly.Msg.BOTBIT_setHSV_TOOLTIP,
  3715. message0: Blockly.Msg.BOTBIT_setHSV_MESSAGE0,
  3716. args0: [{
  3717. options: [[Blockly.Msg.BOTBIT_MOONWALKER_L, "4"], [Blockly.Msg.BOTBIT_MOONWALKER_R, "5"]],
  3718. type: "field_dropdown",
  3719. name: "left_right"
  3720. }, {
  3721. check: "Number",
  3722. type: "input_value",
  3723. name: "h"
  3724. }, {
  3725. check: "Number",
  3726. type: "input_value",
  3727. name: "s"
  3728. }, {
  3729. check: "Number",
  3730. type: "input_value",
  3731. name: "v"
  3732. }]
  3733. })
  3734. }
  3735. };
  3736. Blockly.Blocks.botbit_setRGB = {
  3737. init: function () {
  3738. this.jsonInit({
  3739. inputsInline: !0,
  3740. nextStatement: null,
  3741. previousStatement: null,
  3742. colour: 30,
  3743. helpUrl: Blockly.Msg.BOTBIT_setRGB_HELPURL,
  3744. tooltip: Blockly.Msg.BOTBIT_setRGB_TOOLTIP,
  3745. message0: Blockly.Msg.BOTBIT_setRGB_MESSAGE0,
  3746. args0: [{
  3747. options: [[Blockly.Msg.BOTBIT_MOONWALKER_L, "2"], [Blockly.Msg.BOTBIT_MOONWALKER_R, "3"]],
  3748. type: "field_dropdown",
  3749. name: "left_right"
  3750. }, {
  3751. check: "Number",
  3752. type: "input_value",
  3753. name: "r"
  3754. }, {
  3755. check: "Number",
  3756. type: "input_value",
  3757. name: "g"
  3758. }, {
  3759. check: "Number",
  3760. type: "input_value",
  3761. name: "b"
  3762. }]
  3763. })
  3764. }
  3765. };
  3766. Blockly.Blocks.botbit_turn = {
  3767. init: function () {
  3768. this.jsonInit({
  3769. inputsInline: !0,
  3770. nextStatement: null,
  3771. previousStatement: null,
  3772. colour: 30,
  3773. helpUrl: Blockly.Msg.BOTBIT_TURN_HELPURL,
  3774. tooltip: Blockly.Msg.BOTBIT_TURN_TOOLTIP,
  3775. message0: Blockly.Msg.BOTBIT_TURN_MESSAGE0,
  3776. args0: [{
  3777. check: "Number",
  3778. type: "input_value",
  3779. name: "steps"
  3780. }, {
  3781. check: "Number",
  3782. type: "input_value",
  3783. name: "t"
  3784. }, {
  3785. options: [[Blockly.Msg.BOTBIT_MOTOR_FORWARD, "1"], [Blockly.Msg.BOTBIT_MOTOR_BACKWARD, "-1"]],
  3786. type: "field_dropdown",
  3787. name: "dir"
  3788. }]
  3789. })
  3790. }
  3791. };
  3792. Blockly.Blocks.botbit_jump = {
  3793. init: function () {
  3794. this.jsonInit({
  3795. inputsInline: !0,
  3796. nextStatement: null,
  3797. previousStatement: null,
  3798. colour: 30,
  3799. helpUrl: Blockly.Msg.BOTBIT_JUMP_HELPURL,
  3800. tooltip: Blockly.Msg.BOTBIT_JUMP_TOOLTIP,
  3801. message0: Blockly.Msg.BOTBIT_JUMP_MESSAGE0,
  3802. args0: [{
  3803. check: "Number",
  3804. type: "input_value",
  3805. name: "t"
  3806. }]
  3807. })
  3808. }
  3809. };
  3810. Blockly.Blocks.botbit_spd = {
  3811. init: function () {
  3812. this.jsonInit({
  3813. colour: 30,
  3814. args0: [{
  3815. name: "spd",
  3816. type: "field_dropdown",
  3817. options: [["2000", "2000"], ["1000", "1000"], ["500", "500"], ["0", "0"], ["-500", "-500"], ["-1000", "-1000"], ["-2000", "-2000"]]
  3818. }],
  3819. helpUrl: "",
  3820. tooltip: "",
  3821. message0: "%1",
  3822. output: "Number"
  3823. })
  3824. }
  3825. };
  3826. Blockly.Blocks.botbit_motor_on = {
  3827. init: function () {
  3828. this.jsonInit({
  3829. colour: 30,
  3830. args0: [{
  3831. type: "input_dummy"
  3832. }, {
  3833. name: "speedl",
  3834. type: "input_value",
  3835. check: "Number"
  3836. }, {
  3837. name: "speedr",
  3838. type: "input_value",
  3839. check: "Number"
  3840. }],
  3841. helpUrl: Blockly.Msg.BOTBIT_MOTOR_ON_HELPURL,
  3842. tooltip: Blockly.Msg.BOTBIT_MOTOR_ON_TOOLTIP,
  3843. message0: Blockly.Msg.BOTBIT_MOTOR_ON_MESSAGE0,
  3844. nextStatement: null,
  3845. previousStatement: null
  3846. })
  3847. }
  3848. };
  3849. Blockly.Blocks.botbit_holdBall = {
  3850. init: function () {
  3851. this.jsonInit({
  3852. colour: 30,
  3853. helpUrl: Blockly.Msg.BOTBIT_HOLDBALL_HELPURL,
  3854. tooltip: Blockly.Msg.BOTBIT_HOLDBALL_TOOLTIP,
  3855. message0: Blockly.Msg.BOTBIT_HOLDBALL_MESSAGE0,
  3856. nextStatement: null,
  3857. previousStatement: null
  3858. })
  3859. }
  3860. };
  3861. Blockly.Blocks.botbit_Steering_EngineL = {
  3862. init: function () {
  3863. this.jsonInit({
  3864. colour: "#e8795b",
  3865. args0: [
  3866. {
  3867. name: "dir",
  3868. type: "field_dropdown",
  3869. options: [[Blockly.Msg.BOTBIT_SERVO_X, "AcX"], [Blockly.Msg.BOTBIT_SERVO_Y, "AcY"], [Blockly.Msg.BOTBIT_SERVO_Z, "AcZ"]]
  3870. }
  3871. ],
  3872. helpUrl: Blockly.Msg.BOTBIT_STEERING_ENGINEL_HELPURL,
  3873. tooltip: Blockly.Msg.BOTBIT_STEERING_ENGINEL_TOOLTIP,
  3874. message0: Blockly.Msg.BOTBIT_STEERING_ENGINEL_MESSAGE0
  3875. //nextStatement: null,
  3876. //previousStatement: null
  3877. })
  3878. this.setOutput(!0);
  3879. }
  3880. };
  3881. Blockly.Blocks.botbit_Steering_Tilt = {
  3882. init: function () {
  3883. this.jsonInit({
  3884. colour: "#e8795b",
  3885. args0: [
  3886. {
  3887. name: "dir",
  3888. type: "field_dropdown",
  3889. options: [[Blockly.Msg.BOTBIT_SERVO_X, "X"], [Blockly.Msg.BOTBIT_SERVO_Y, "Y"], [Blockly.Msg.BOTBIT_SERVO_Z, "Z"]]
  3890. }
  3891. ],
  3892. helpUrl: Blockly.Msg.BOTBIT_STEERING_ENGINEL_HELPURL,
  3893. tooltip: Blockly.Msg.BOTBIT_STEERING_ENGINEL_TOOLTIP,
  3894. message0: Blockly.Msg.BOTBIT_STEERING_ENGINET_MESSAGE0
  3895. })
  3896. this.setOutput(!0);
  3897. }
  3898. };
  3899. Blockly.Blocks.botbit_Steering_RGB = {
  3900. init: function () {
  3901. var _input = this.appendDummyInput();
  3902. _input.appendField(Blockly.Msg.X);
  3903. this.appendValueInput("R").setCheck("Number");
  3904. _input = this.appendDummyInput();
  3905. _input.appendField(Blockly.Msg.Y)
  3906. this.appendValueInput("G").setCheck("Number");
  3907. _input = this.appendDummyInput();
  3908. _input.appendField(Blockly.Msg.Y)
  3909. this.appendValueInput("B").setCheck("Number");
  3910. this.setInputsInline(!0);
  3911. this.setHelpUrl(Blockly.Msg.LOGIC_OPERATION_HELPURL);
  3912. this.setColour("#5bb2d6");
  3913. this.setOutput(!0, "Boolean");
  3914. }
  3915. };
  3916. Blockly.Blocks.botbit_Steering_RGB = function (block) {
  3917. var _r = Blockly.Python.valueToCode(block, "R", Blockly.Python.ORDER_ATOMIC);
  3918. var _g = Blockly.Python.valueToCode(block, "G", Blockly.Python.ORDER_ATOMIC);
  3919. var _b = Blockly.Python.valueToCode(block, "B", Blockly.Python.ORDER_ATOMIC);
  3920. var code = "(" + _r + ", " + _g + ", " + _b + ")";
  3921. return [code, Blockly.Python.ORDER_ATOMIC];
  3922. };
  3923. Blockly.Blocks.botbit_Steering_XY = {
  3924. init: function () {
  3925. var _input = this.appendDummyInput();
  3926. this.setHelpUrl(Blockly.Msg.LOGIC_OPERATION_HELPURL);
  3927. this.setColour("#5bb2d6");
  3928. this.setOutput(!0, "Boolean");
  3929. _input.appendField(Blockly.Msg.X);
  3930. this.appendValueInput("A").setCheck("Number");
  3931. _input = this.appendDummyInput();
  3932. _input.appendField(Blockly.Msg.Y)
  3933. this.appendValueInput("B").setCheck("Number");
  3934. this.setInputsInline(!0);
  3935. }
  3936. };
  3937. Blockly.Python.botbit_Steering_XY = function (block) {
  3938. var _x = Blockly.Python.valueToCode(block, "A", Blockly.Python.ORDER_ATOMIC);
  3939. var _y = Blockly.Python.valueToCode(block, "B", Blockly.Python.ORDER_ATOMIC);
  3940. var code = "(" + _x + ", " + _y + ")";
  3941. return [code, Blockly.Python.ORDER_ATOMIC];
  3942. };
  3943. Blockly.Blocks.botbit_Steering_WH = {
  3944. init: function () {
  3945. var _input = this.appendDummyInput();
  3946. this.setHelpUrl(Blockly.Msg.LOGIC_OPERATION_HELPURL);
  3947. this.setColour("#5bb2d6");
  3948. this.setOutput(!0, "Boolean");
  3949. _input.appendField(Blockly.Msg.W);
  3950. this.appendValueInput("A").setCheck("Number");
  3951. _input = this.appendDummyInput();
  3952. _input.appendField(Blockly.Msg.H)
  3953. this.appendValueInput("B").setCheck("Number");
  3954. this.setInputsInline(!0);
  3955. }
  3956. };
  3957. Blockly.Python.botbit_Steering_WH = function (block) {
  3958. var _x = Blockly.Python.valueToCode(block, "A", Blockly.Python.ORDER_ATOMIC);
  3959. var _y = Blockly.Python.valueToCode(block, "B", Blockly.Python.ORDER_ATOMIC);
  3960. var code = "(" + _x + ", " + _y + ")";
  3961. return [code, Blockly.Python.ORDER_ATOMIC];
  3962. };
  3963. Blockly.Blocks.botbit_Steering_Engine_leg = {
  3964. init: function () {
  3965. this.jsonInit({
  3966. colour: 30,
  3967. args0: [{
  3968. name: "leg",
  3969. type: "field_dropdown",
  3970. options: [[Blockly.Msg.BOTBIT_MOTOR_LEFT, "l"], [Blockly.Msg.BOTBIT_MOTOR_RIGHT, "r"]]
  3971. }, {
  3972. name: "dir",
  3973. type: "field_dropdown",
  3974. options: [[Blockly.Msg.BOTBIT_SERVO_UP, "y"], [Blockly.Msg.BOTBIT_SERVO_DOWN, "x"]]
  3975. }, {
  3976. name: "walk",
  3977. type: "input_value",
  3978. check: "Number"
  3979. }],
  3980. helpUrl: Blockly.Msg.BOTBIT_STEERING_ENGINE_LEG_HELPURL,
  3981. tooltip: Blockly.Msg.BOTBIT_STEERING_ENGINE_LEG_TOOLTIP,
  3982. message0: Blockly.Msg.BOTBIT_STEERING_ENGINE_LEG_MESSAGE0,
  3983. nextStatement: null,
  3984. previousStatement: null
  3985. })
  3986. }
  3987. };
  3988. Blockly.Blocks.botbit_updatePosition = {
  3989. init: function () {
  3990. this.jsonInit({
  3991. colour: 30,
  3992. helpUrl: Blockly.Msg.BOTBIT_UPDATEPOSITION_HELPURL,
  3993. tooltip: Blockly.Msg.BOTBIT_UPDATEPOSITION_TOOLTIP,
  3994. message0: Blockly.Msg.BOTBIT_UPDATEPOSITION_MESSAGE0,
  3995. nextStatement: null,
  3996. previousStatement: null
  3997. })
  3998. }
  3999. };
  4000. Blockly.Blocks.botbit_Ultrasonic = {
  4001. init: function () {
  4002. this.jsonInit({
  4003. colour: 30,
  4004. helpUrl: Blockly.Msg.BOTBIT_ULTRASONIC_HELPURL,
  4005. tooltip: Blockly.Msg.BOTBIT_ULTRASONIC_TOOLTIP,
  4006. message0: Blockly.Msg.BOTBIT_ULTRASONIC_MESSAGE0,
  4007. output: "Number"
  4008. })
  4009. }
  4010. };
  4011. Blockly.Blocks.botbit_walking = {
  4012. init: function () {
  4013. this.jsonInit({
  4014. colour: 30,
  4015. args0: [{
  4016. name: "fx",
  4017. type: "field_dropdown",
  4018. options: [[Blockly.Msg.BOTBIT_WALKING_FORWARD, "-1"], [Blockly.Msg.BOTBIT_WALKING_BACK, "1"]]
  4019. }, {
  4020. name: "steps",
  4021. type: "input_value",
  4022. check: "Number"
  4023. }, {
  4024. name: "T",
  4025. type: "input_value",
  4026. check: "Number"
  4027. }],
  4028. helpUrl: Blockly.Msg.BOTBIT_WALKING_HELPURL,
  4029. tooltip: Blockly.Msg.BOTBIT_WALKING_TOOLTIP,
  4030. message0: Blockly.Msg.BOTBIT_WALKING_MESSAGE0,
  4031. nextStatement: null,
  4032. previousStatement: null
  4033. })
  4034. }
  4035. };
  4036. Blockly.Blocks.botbit_moonwalker = {
  4037. init: function () {
  4038. this.jsonInit({
  4039. colour: 30,
  4040. args0: [{
  4041. name: "fx",
  4042. type: "field_dropdown",
  4043. options: [[Blockly.Msg.BOTBIT_MOONWALKER_L, "-1"], [Blockly.Msg.BOTBIT_MOONWALKER_R, "1"]]
  4044. }, {
  4045. name: "steps2",
  4046. type: "input_value",
  4047. check: "Number"
  4048. }, {
  4049. name: "T2",
  4050. type: "input_value",
  4051. check: "Number"
  4052. }, {
  4053. name: "amplitude",
  4054. type: "input_value",
  4055. check: "Number"
  4056. }],
  4057. helpUrl: Blockly.Msg.BOTBIT_MOONWALKER_HELPURL,
  4058. tooltip: Blockly.Msg.BOTBIT_MOONWALKER_TOOLTIP,
  4059. message0: Blockly.Msg.BOTBIT_MOONWALKER_MESSAGE0,
  4060. nextStatement: null,
  4061. previousStatement: null
  4062. })
  4063. }
  4064. };
  4065. Blockly.Blocks.botbit_PIDtracking = {
  4066. init: function () {
  4067. this.jsonInit({
  4068. colour: 30,
  4069. args0: [{
  4070. type: "input_dummy"
  4071. }, {
  4072. name: "kp",
  4073. type: "input_value",
  4074. check: "Number"
  4075. }, {
  4076. name: "kd",
  4077. type: "input_value",
  4078. check: "Number"
  4079. }, {
  4080. name: "trackSpeed",
  4081. type: "input_value",
  4082. check: "Number"
  4083. }],
  4084. helpUrl: Blockly.Msg.BOTBIT_PIDtracking_HELPURL,
  4085. tooltip: Blockly.Msg.BOTBIT_PIDtracking_TOOLTIP,
  4086. message0: Blockly.Msg.BOTBIT_PIDtracking_MESSAGE0,
  4087. nextStatement: null,
  4088. previousStatement: null
  4089. })
  4090. }
  4091. };
  4092. Blockly.Blocks.botbit_crusaito = {
  4093. init: function () {
  4094. this.jsonInit({
  4095. colour: 30,
  4096. args0: [{
  4097. name: "fx",
  4098. type: "field_dropdown",
  4099. options: [[Blockly.Msg.BOTBIT_CRUSAITO_CW, "-1"], [Blockly.Msg.BOTBIT_CRUSAITO_ANTICW, "1"]]
  4100. }, {
  4101. name: "steps3",
  4102. type: "input_value",
  4103. check: "Number"
  4104. }, {
  4105. name: "T3",
  4106. type: "input_value",
  4107. check: "Number"
  4108. }, {
  4109. name: "amplitude3",
  4110. type: "input_value",
  4111. check: "Number"
  4112. }],
  4113. helpUrl: Blockly.Msg.BOTBIT_CRUSAITO_HELPURL,
  4114. tooltip: Blockly.Msg.BOTBIT_CRUSAITO_TOOLTIP,
  4115. message0: Blockly.Msg.BOTBIT_CRUSAITO_MESSAGE0,
  4116. nextStatement: null,
  4117. previousStatement: null
  4118. })
  4119. }
  4120. };
  4121. Blockly.Blocks.botbit_flapping = {
  4122. init: function () {
  4123. this.jsonInit({
  4124. colour: 30,
  4125. args0: [{
  4126. name: "fx",
  4127. type: "field_dropdown",
  4128. options: [[Blockly.Msg.BOTBIT_FLAPPING_FORWARD, "-1"], [Blockly.Msg.BOTBIT_FLAPPING_BACK, "1"]]
  4129. }, {
  4130. name: "steps4",
  4131. type: "input_value",
  4132. check: "Number"
  4133. }, {
  4134. name: "T4",
  4135. type: "input_value",
  4136. check: "Number"
  4137. }, {
  4138. name: "amplitude4",
  4139. type: "input_value",
  4140. check: "Number"
  4141. }],
  4142. helpUrl: Blockly.Msg.BOTBIT_FLAPPING_HELPURL,
  4143. tooltip: Blockly.Msg.BOTBIT_FLAPPING_TOOLTIP,
  4144. message0: Blockly.Msg.BOTBIT_FLAPPING_MESSAGE0,
  4145. nextStatement: null,
  4146. previousStatement: null
  4147. })
  4148. }
  4149. };
  4150. Blockly.Blocks.botbit_home = {
  4151. init: function () {
  4152. this.jsonInit({
  4153. colour: 30,
  4154. helpUrl: Blockly.Msg.BOTBIT_HOME_HELPURL,
  4155. tooltip: Blockly.Msg.BOTBIT_HOME_TOOLTIP,
  4156. message0: Blockly.Msg.BOTBIT_HOME_MESSAGE0,
  4157. nextStatement: null,
  4158. previousStatement: null
  4159. })
  4160. }
  4161. };
  4162. Blockly.Blocks.Carbit_init = {
  4163. init: function () {
  4164. this.jsonInit({
  4165. colour: 88,
  4166. nextStatement: null,
  4167. previousStatement: null,
  4168. message0: Blockly.Msg.Carbit_init_MESSAGE0,
  4169. tooltip: Blockly.Msg.Carbit_init_TOOLTIP,
  4170. helpUrl: Blockly.Msg.Carbit_init_HELPURL
  4171. })
  4172. }
  4173. };
  4174. Blockly.Blocks.Carbit_setLeftMotor = {
  4175. init: function () {
  4176. this.jsonInit({
  4177. colour: 88,
  4178. args0: [{
  4179. name: "LeftMotor",
  4180. type: "input_value",
  4181. check: "Number"
  4182. }],
  4183. helpUrl: Blockly.Msg.Carbit_setLeftMotor_HELPURL,
  4184. tooltip: Blockly.Msg.Carbit_setLeftMotor_TOOLTIP,
  4185. message0: Blockly.Msg.Carbit_setLeftMotor_MESSAGE0,
  4186. nextStatement: null,
  4187. previousStatement: null
  4188. })
  4189. }
  4190. };
  4191. Blockly.Blocks.Carbit_setRightMotor = {
  4192. init: function () {
  4193. this.jsonInit({
  4194. colour: 88,
  4195. args0: [{
  4196. name: "RightMotor",
  4197. type: "input_value",
  4198. check: "Number"
  4199. }],
  4200. helpUrl: Blockly.Msg.Carbit_setRightMotor_HELPURL,
  4201. tooltip: Blockly.Msg.Carbit_setRightMotor_TOOLTIP,
  4202. message0: Blockly.Msg.Carbit_setRightMotor_MESSAGE0,
  4203. nextStatement: null,
  4204. previousStatement: null
  4205. })
  4206. }
  4207. };
  4208. Blockly.Blocks.Carbit_analog_light = {
  4209. init: function () {
  4210. this.jsonInit({
  4211. colour: 88,
  4212. args0: [{
  4213. name: "light",
  4214. type: "field_dropdown",
  4215. options: [["Q3", "1"], ["Q4", "2"]]
  4216. }],
  4217. helpUrl: Blockly.Msg.Carbit_analog_light_HELPURL,
  4218. tooltip: Blockly.Msg.Carbit_analog_light_TOOLTIP,
  4219. message0: Blockly.Msg.Carbit_analog_light_MESSAGE0,
  4220. output: "Number"
  4221. })
  4222. }
  4223. };
  4224. Blockly.Blocks.Carbit_Speed_U10 = {
  4225. init: function () {
  4226. this.jsonInit({
  4227. colour: 88,
  4228. helpUrl: Blockly.Msg.Carbit_Speed_U10_HELPURL,
  4229. tooltip: Blockly.Msg.Carbit_Speed_U10_TOOLTIP,
  4230. message0: Blockly.Msg.Carbit_Speed_U10_MESSAGE0,
  4231. output: "Number"
  4232. })
  4233. }
  4234. };
  4235. Blockly.Blocks.Carbit_Speed_U11 = {
  4236. init: function () {
  4237. this.jsonInit({
  4238. colour: 88,
  4239. helpUrl: Blockly.Msg.Carbit_Speed_U11_HELPURL,
  4240. tooltip: Blockly.Msg.Carbit_Speed_U11_TOOLTIP,
  4241. message0: Blockly.Msg.Carbit_Speed_U11_MESSAGE0,
  4242. output: "Number"
  4243. })
  4244. }
  4245. };
  4246. Blockly.Blocks.Carbit_Distance = {
  4247. init: function () {
  4248. this.jsonInit({
  4249. colour: 88,
  4250. helpUrl: Blockly.Msg.Carbit_Distance_HELPURL,
  4251. tooltip: Blockly.Msg.Carbit_Distance_TOOLTIP,
  4252. message0: Blockly.Msg.Carbit_Distance_MESSAGE0,
  4253. output: "Number"
  4254. })
  4255. }
  4256. };
  4257. Blockly.Blocks.Carbit_tracking = {
  4258. init: function () {
  4259. this.jsonInit({
  4260. colour: 88,
  4261. args0: [{
  4262. type: "input_dummy"
  4263. }, {
  4264. name: "k_speed",
  4265. type: "input_value",
  4266. check: "Number"
  4267. }, {
  4268. name: "speedMax",
  4269. type: "input_value",
  4270. check: "Number"
  4271. }, {
  4272. name: "speedScale",
  4273. type: "input_value",
  4274. check: "Number"
  4275. }, {
  4276. name: "turnDelay",
  4277. type: "input_value",
  4278. check: "Number"
  4279. }],
  4280. helpUrl: Blockly.Msg.Carbit_tracking_HELPURL,
  4281. tooltip: Blockly.Msg.Carbit_tracking_TOOLTIP,
  4282. message0: Blockly.Msg.Carbit_tracking_MESSAGE0,
  4283. nextStatement: null,
  4284. previousStatement: null
  4285. })
  4286. }
  4287. };
  4288. var gamebitColor = 230;
  4289. Blockly.Blocks.gamebit_xy = {
  4290. init: function () {
  4291. this.jsonInit({
  4292. inputsInline: !0,
  4293. output: "Number",
  4294. colour: gamebitColor,
  4295. helpUrl: Blockly.Msg.GAMEBIT_XY_HELPURL,
  4296. tooltip: Blockly.Msg.GAMEBIT_XY_TOOLTIP,
  4297. message0: Blockly.Msg.GAMEBIT_XY_MESSAGE0,
  4298. args0: [{
  4299. options: [["X", "2"], ["Y", "1"]],
  4300. type: "field_dropdown",
  4301. name: "xy"
  4302. }]
  4303. })
  4304. }
  4305. };
  4306. Blockly.Blocks.gamebit_shake = {
  4307. init: function () {
  4308. this.jsonInit({
  4309. inputsInline: !0,
  4310. nextStatement: null,
  4311. previousStatement: null,
  4312. colour: gamebitColor,
  4313. helpUrl: Blockly.Msg.GAMEBIT_SHAKE_HELPURL,
  4314. tooltip: Blockly.Msg.GAMEBIT_SHAKE_TOOLTIP,
  4315. message0: Blockly.Msg.GAMEBIT_SHAKE_MESSAGE0,
  4316. args0: [{
  4317. options: [[Blockly.Msg.LABPLUS_USB_SWITCH_OFF, "0"], [Blockly.Msg.LABPLUS_USB_SWITCH_ON, "1"]],
  4318. type: "field_dropdown",
  4319. name: "shake"
  4320. }]
  4321. })
  4322. }
  4323. };
  4324. Blockly.Blocks.gamebit_button = {
  4325. init: function () {
  4326. this.jsonInit({
  4327. inputsInline: !0,
  4328. output: "Boolean",
  4329. colour: gamebitColor,
  4330. helpUrl: Blockly.Msg.GAMEBIT_BUTTON_HELPURL,
  4331. tooltip: Blockly.Msg.GAMEBIT_BUTTON_TOOLTIP,
  4332. message0: Blockly.Msg.GAMEBIT_BUTTON_MESSAGE0,
  4333. args0: [{
  4334. options: [["START", "6"], ["SElECT", "7"], ["A", "4"], ["B", "3"], ["X", "2"], ["Y", "1"], ["Z", "5"]],
  4335. type: "field_dropdown",
  4336. name: "button"
  4337. }]
  4338. })
  4339. }
  4340. };
  4341. var COLOR_MU = "#FF6600";
  4342. Blockly.Blocks.microbit_mu_init = {
  4343. init: function () {
  4344. this.jsonInit({
  4345. colour: COLOR_MU,
  4346. args0: [{
  4347. name: "address",
  4348. options: [["0x60", "0x60"], ["0x61", "0x61"], ["0x62", "0x62"], ["0x63", "0x63"]],
  4349. type: "field_dropdown"
  4350. }],
  4351. nextStatement: null,
  4352. previousStatement: null,
  4353. message0: Blockly.Msg.MICROBIT_MU_INIT_MESSAGE0,
  4354. tooltip: Blockly.Msg.MICROBIT_MU_INIT_TOOLTIP,
  4355. helpUrl: Blockly.Msg.MICROBIT_MU_INIT_HELPURL
  4356. })
  4357. }
  4358. };
  4359. Blockly.Blocks.microbit_mu_begin = {
  4360. init: function () {
  4361. this.jsonInit({
  4362. colour: COLOR_MU,
  4363. args0: [{
  4364. check: "String",
  4365. type: "input_value",
  4366. name: "vision_type"
  4367. }],
  4368. nextStatement: null,
  4369. previousStatement: null,
  4370. message0: Blockly.Msg.MICROBIT_MU_BEGIN_MESSAGE0,
  4371. tooltip: Blockly.Msg.MICROBIT_MU_BEGIN_TOOLTIP,
  4372. helpUrl: Blockly.Msg.MICROBIT_MU_BEGIN_HELPURL
  4373. })
  4374. }
  4375. };
  4376. Blockly.Blocks.microbit_mu_vision_type_multi = {
  4377. init: function () {
  4378. this.jsonInit({
  4379. colour: COLOR_MU,
  4380. args0: [{
  4381. checked: !1,
  4382. type: "field_checkbox",
  4383. name: "type1"
  4384. }, {
  4385. checked: !1,
  4386. type: "field_checkbox",
  4387. name: "type2"
  4388. }, {
  4389. type: "input_dummy"
  4390. }, {
  4391. checked: !1,
  4392. type: "field_checkbox",
  4393. name: "type3"
  4394. }, {
  4395. checked: !1,
  4396. type: "field_checkbox",
  4397. name: "type4"
  4398. }, {
  4399. type: "input_dummy"
  4400. }, {
  4401. checked: !1,
  4402. type: "field_checkbox",
  4403. name: "type5"
  4404. }, {
  4405. checked: !1,
  4406. type: "field_checkbox",
  4407. name: "type6"
  4408. }, {
  4409. type: "input_dummy"
  4410. }, {
  4411. checked: !1,
  4412. type: "field_checkbox",
  4413. name: "type7"
  4414. }, {
  4415. checked: !1,
  4416. type: "field_checkbox",
  4417. name: "type8"
  4418. }],
  4419. output: "String",
  4420. message0: Blockly.Msg.MICROBIT_MU_VISION_TYPE_MESSAGE0,
  4421. tooltip: "",
  4422. helpUrl: ""
  4423. })
  4424. }
  4425. };
  4426. Blockly.Blocks.microbit_mu_vision_type = {
  4427. init: function () {
  4428. this.jsonInit({
  4429. colour: COLOR_MU,
  4430. args0: [{
  4431. name: "vision_type",
  4432. options: [[Blockly.Msg.MICROBIT_MU_VISION_COLOR_DETECT, "VISION_COLOR_DETECT"], [Blockly.Msg.MICROBIT_MU_VISION_COLOR_RECOGNITION, "VISION_COLOR_RECOGNITION"], [Blockly.Msg.MICROBIT_MU_VISION_BALL_DETECT, "VISION_BALL_DETECT"], [Blockly.Msg.MICROBIT_MU_VISION_BODY_DETECT, "VISION_BODY_DETECT"], [Blockly.Msg.MICROBIT_MU_VISION_SHAPE_CARD_DETECT, "VISION_SHAPE_CARD_DETECT"], [Blockly.Msg.MICROBIT_MU_VISION_TRAFFIC_CARD_DETECT, "VISION_TRAFFIC_CARD_DETECT"], [Blockly.Msg.MICROBIT_MU_VISION_NUM_CARD_DETECT, "VISION_NUM_CARD_DETECT"]],
  4433. type: "field_dropdown"
  4434. }],
  4435. output: "String",
  4436. message0: "%1",
  4437. tooltip: "",
  4438. helpUrl: ""
  4439. })
  4440. }
  4441. };
  4442. Blockly.Blocks.microbit_mu_set_level = {
  4443. init: function () {
  4444. this.jsonInit({
  4445. colour: COLOR_MU,
  4446. args0: [{
  4447. check: "String",
  4448. type: "input_value",
  4449. name: "vision_type"
  4450. }, {
  4451. name: "level",
  4452. options: [[Blockly.Msg.MICROBIT_MU_LEVEL_DEFAULT, "LevelDefault"], [Blockly.Msg.MICROBIT_MU_LEVEL_SPEED, "LevelSpeed"], [Blockly.Msg.MICROBIT_MU_LEVEL_BALANCE, "LevelBalance"], [Blockly.Msg.MICROBIT_MU_LEVEL_ACCURACY, "LevelAccuracy"]],
  4453. type: "field_dropdown"
  4454. }],
  4455. nextStatement: null,
  4456. previousStatement: null,
  4457. message0: Blockly.Msg.MICROBIT_MU_SET_LEVEL_MESSAGE0,
  4458. tooltip: Blockly.Msg.MICROBIT_MU_SET_LEVEL_TOOLTIP,
  4459. helpUrl: Blockly.Msg.MICROBIT_MU_SET_LEVEL_HELPURL
  4460. })
  4461. }
  4462. };
  4463. Blockly.Blocks.microbit_mu_get_level = {
  4464. init: function () {
  4465. this.jsonInit({
  4466. colour: COLOR_MU,
  4467. args0: [{
  4468. check: "String",
  4469. type: "input_value",
  4470. name: "vision_type"
  4471. }],
  4472. output: "Number",
  4473. message0: Blockly.Msg.MICROBIT_MU_GET_LEVEL_MESSAGE0,
  4474. tooltip: Blockly.Msg.MICROBIT_MU_GET_LEVEL_TOOLTIP,
  4475. helpUrl: Blockly.Msg.MICROBIT_MU_GET_LEVEL_HELPURL
  4476. })
  4477. }
  4478. };
  4479. Blockly.Blocks.microbit_mu_set_fps_mode = {
  4480. init: function () {
  4481. this.jsonInit({
  4482. colour: COLOR_MU,
  4483. args0: [{
  4484. name: "mode",
  4485. options: [[Blockly.Msg.MICROBIT_MU_FPS_NORMAL, "FPSNormal"], [Blockly.Msg.MICROBIT_MU_FPS_HIGH, "FPSHigh"]],
  4486. type: "field_dropdown"
  4487. }],
  4488. nextStatement: null,
  4489. previousStatement: null,
  4490. message0: Blockly.Msg.MICROBIT_MU_SET_FPS_MODE_MESSAGE0,
  4491. tooltip: Blockly.Msg.MICROBIT_MU_SET_FPS_MODE_TOOLTIP,
  4492. helpUrl: Blockly.Msg.MICROBIT_MU_SET_FPS_MODE_HELPURL
  4493. })
  4494. }
  4495. };
  4496. Blockly.Blocks.microbit_mu_get_fps_mode = {
  4497. init: function () {
  4498. this.jsonInit({
  4499. colour: COLOR_MU,
  4500. output: "Number",
  4501. message0: Blockly.Msg.MICROBIT_MU_GET_FPS_MODE_MESSAGE0,
  4502. tooltip: Blockly.Msg.MICROBIT_MU_GET_FPS_MODE_TOOLTIP,
  4503. helpUrl: Blockly.Msg.MICROBIT_MU_GET_FPS_MODE_HELPURL
  4504. })
  4505. }
  4506. };
  4507. Blockly.Blocks.microbit_mu_set_awb_mode = {
  4508. init: function () {
  4509. this.jsonInit({
  4510. colour: COLOR_MU,
  4511. args0: [{
  4512. name: "mode",
  4513. options: [[Blockly.Msg.MICROBIT_MU_AUTO_WHITE_BALANCE, "AutoWhiteBalance"], [Blockly.Msg.MICROBIT_MU_LOCK_WHITE_BALANCE, "LockWhiteBalance"], [Blockly.Msg.MICROBIT_MU_WHITE_LIGHT, "WhiteLight"], [Blockly.Msg.MICROBIT_MU_YELLOW_LIGHT, "YellowLight"]],
  4514. type: "field_dropdown"
  4515. }],
  4516. nextStatement: null,
  4517. previousStatement: null,
  4518. message0: Blockly.Msg.MICROBIT_MU_SET_AWB_MODE_MESSAGE0,
  4519. tooltip: Blockly.Msg.MICROBIT_MU_SET_AWB_MODE_TOOLTIP,
  4520. helpUrl: Blockly.Msg.MICROBIT_MU_SET_AWB_MODE_HELPURL
  4521. })
  4522. }
  4523. };
  4524. Blockly.Blocks.microbit_mu_get_awb_mode = {
  4525. init: function () {
  4526. this.jsonInit({
  4527. colour: COLOR_MU,
  4528. output: "Number",
  4529. message0: Blockly.Msg.MICROBIT_MU_GET_AWB_MODE_MESSAGE0,
  4530. tooltip: Blockly.Msg.MICROBIT_MU_GET_AWB_MODE_TOOLTIP,
  4531. helpUrl: Blockly.Msg.MICROBIT_MU_GET_AWB_MODE_HELPURL
  4532. })
  4533. }
  4534. };
  4535. Blockly.Blocks.microbit_mu_set_zoom_mode = {
  4536. init: function () {
  4537. this.jsonInit({
  4538. colour: COLOR_MU,
  4539. args0: [{
  4540. name: "mode",
  4541. options: [[Blockly.Msg.MICROBIT_MU_ZOOM_DEFAULT, "ZoomDefault"], [Blockly.Msg.MICROBIT_MU_ZOOM_1, "Zoom1"], [Blockly.Msg.MICROBIT_MU_ZOOM_2, "Zoom2"], [Blockly.Msg.MICROBIT_MU_ZOOM_3, "Zoom3"], [Blockly.Msg.MICROBIT_MU_ZOOM_4, "Zoom4"], [Blockly.Msg.MICROBIT_MU_ZOOM_5, "Zoom5"]],
  4542. type: "field_dropdown"
  4543. }],
  4544. nextStatement: null,
  4545. previousStatement: null,
  4546. message0: Blockly.Msg.MICROBIT_MU_SET_ZOOM_MODE_MESSAGE0,
  4547. tooltip: Blockly.Msg.MICROBIT_MU_SET_ZOOM_MODE_TOOLTIP,
  4548. helpUrl: Blockly.Msg.MICROBIT_MU_SET_ZOOM_MODE_HELPURL
  4549. })
  4550. }
  4551. };
  4552. Blockly.Blocks.microbit_mu_get_zoom_mode = {
  4553. init: function () {
  4554. this.jsonInit({
  4555. colour: COLOR_MU,
  4556. output: "Number",
  4557. message0: Blockly.Msg.MICROBIT_MU_GET_ZOOM_MODE_MESSAGE0,
  4558. tooltip: Blockly.Msg.MICROBIT_MU_GET_ZOOM_MODE_TOOLTIP,
  4559. helpUrl: Blockly.Msg.MICROBIT_MU_GET_ZOOM_MODE_HELPURL
  4560. })
  4561. }
  4562. };
  4563. Blockly.Blocks.microbit_mu_set_default = {
  4564. init: function () {
  4565. this.jsonInit({
  4566. colour: COLOR_MU,
  4567. nextStatement: null,
  4568. previousStatement: null,
  4569. message0: Blockly.Msg.MICROBIT_MU_SET_DEFAULT_MESSAGE0,
  4570. tooltip: Blockly.Msg.MICROBIT_MU_SET_DEFAULT_TOOLTIP,
  4571. helpUrl: Blockly.Msg.MICROBIT_MU_SET_DEFAULT_HELPURL
  4572. })
  4573. }
  4574. };
  4575. Blockly.Blocks.microbit_mu_restart = {
  4576. init: function () {
  4577. this.jsonInit({
  4578. colour: COLOR_MU,
  4579. nextStatement: null,
  4580. previousStatement: null,
  4581. message0: Blockly.Msg.MICROBIT_MU_RESTART_MESSAGE0,
  4582. tooltip: Blockly.Msg.MICROBIT_MU_RESTART_TOOLTIP,
  4583. helpUrl: Blockly.Msg.MICROBIT_MU_RESTART_HELPURL
  4584. })
  4585. }
  4586. };
  4587. Blockly.Blocks.microbit_mu_led_level = {
  4588. init: function () {
  4589. this.jsonInit({
  4590. colour: COLOR_MU,
  4591. args0: [{
  4592. name: "level",
  4593. options: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"]],
  4594. type: "field_dropdown"
  4595. }],
  4596. output: "Number",
  4597. message0: "%1",
  4598. tooltip: "",
  4599. helpUrl: ""
  4600. })
  4601. }
  4602. };
  4603. Blockly.Blocks.microbit_mu_led_set_color = {
  4604. init: function () {
  4605. this.jsonInit({
  4606. colour: COLOR_MU,
  4607. args0: [{
  4608. name: "led",
  4609. options: [["Led1", "Led1"], ["Led2", "Led2"], ["LedAll", "LedAll"]],
  4610. type: "field_dropdown"
  4611. }, {
  4612. check: "Number",
  4613. type: "input_value",
  4614. name: "level"
  4615. }, {
  4616. name: "detected_color",
  4617. options: [[Blockly.Msg.MICROBIT_MU_LED_CLOSE, "LedClose"], [Blockly.Msg.MICROBIT_MU_LED_RED, "LedRed"], [Blockly.Msg.MICROBIT_MU_LED_GREEN, "LedGreen"], [Blockly.Msg.MICROBIT_MU_LED_YELLOW, "LedYellow"], [Blockly.Msg.MICROBIT_MU_LED_BLUE, "LedBlue"], [Blockly.Msg.MICROBIT_MU_LED_PURPLE, "LedPurple"], [Blockly.Msg.MICROBIT_MU_LED_CYAN, "LedCyan"], [Blockly.Msg.MICROBIT_MU_LED_WHITE, "LedWhite"]],
  4618. type: "field_dropdown"
  4619. }, {
  4620. type: "input_dummy"
  4621. }, {
  4622. name: "undetected_color",
  4623. options: [[Blockly.Msg.MICROBIT_MU_LED_CLOSE, "LedClose"], [Blockly.Msg.MICROBIT_MU_LED_RED, "LedRed"], [Blockly.Msg.MICROBIT_MU_LED_GREEN, "LedGreen"], [Blockly.Msg.MICROBIT_MU_LED_YELLOW, "LedYellow"], [Blockly.Msg.MICROBIT_MU_LED_BLUE, "LedBlue"], [Blockly.Msg.MICROBIT_MU_LED_PURPLE, "LedPurple"], [Blockly.Msg.MICROBIT_MU_LED_CYAN, "LedCyan"], [Blockly.Msg.MICROBIT_MU_LED_WHITE, "LedWhite"]],
  4624. type: "field_dropdown"
  4625. }],
  4626. nextStatement: null,
  4627. previousStatement: null,
  4628. message0: Blockly.Msg.MICROBIT_MU_LED_SET_COLOR_MESSAGE0,
  4629. tooltip: Blockly.Msg.MICROBIT_MU_LED_SET_COLOR_TOOLTIP,
  4630. helpUrl: Blockly.Msg.MICROBIT_MU_LED_SET_COLOR_HELPURL
  4631. })
  4632. }
  4633. };
  4634. Blockly.Blocks.microbit_mu_get_value = {
  4635. init: function () {
  4636. this.jsonInit({
  4637. colour: COLOR_MU,
  4638. args0: [{
  4639. check: "String",
  4640. type: "input_value",
  4641. name: "vision_type"
  4642. }, {
  4643. name: "object_inf",
  4644. options: [[Blockly.Msg.MICROBIT_MU_VALUE_STATUS, "Status"], [Blockly.Msg.MICROBIT_MU_VALUE_XVALUE, "XValue"], [Blockly.Msg.MICROBIT_MU_VALUE_YVALUE, "YValue"], [Blockly.Msg.MICROBIT_MU_VALUE_WIDTHVALUE, "WidthValue"], [Blockly.Msg.MICROBIT_MU_VALUE_HEIGHTVALUE, "HeightValue"], [Blockly.Msg.MICROBIT_MU_VALUE_LABEL, "Label"], [Blockly.Msg.MICROBIT_MU_VALUE_RVALUE, "RValue"], [Blockly.Msg.MICROBIT_MU_VALUE_GVALUE, "GValue"], [Blockly.Msg.MICROBIT_MU_VALUE_BVALUE, "BValue"]],
  4645. type: "field_dropdown"
  4646. }],
  4647. output: null,
  4648. message0: Blockly.Msg.MICROBIT_MU_GET_VALUE_MESSAGE0,
  4649. tooltip: Blockly.Msg.MICROBIT_MU_GET_VALUE_TOOLTIP,
  4650. helpUrl: Blockly.Msg.MICROBIT_MU_GET_VALUE_HELPURL
  4651. })
  4652. }
  4653. };
  4654. Blockly.Blocks.microbit_mu_ls_type = {
  4655. init: function () {
  4656. this.jsonInit({
  4657. colour: COLOR_MU,
  4658. args0: [{
  4659. name: "ls_type",
  4660. options: [[Blockly.Msg.MICROBIT_MU_LS_PROXIMITY_ENABLE, "LS_PROXIMITY_ENABLE"], [Blockly.Msg.MICROBIT_MU_LS_AMBIENT_LIGHT_ENABLE, "LS_AMBIENT_LIGHT_ENABLE"], [Blockly.Msg.MICROBIT_MU_LS_COLOR_ENABLE, "LS_COLOR_ENABLE"], [Blockly.Msg.MICROBIT_MU_LS_GESTURE_ENABLE, "LS_GESTURE_ENABLE"]],
  4661. type: "field_dropdown"
  4662. }],
  4663. output: "String",
  4664. message0: "%1",
  4665. tooltip: "",
  4666. helpUrl: ""
  4667. })
  4668. }
  4669. };
  4670. Blockly.Blocks.microbit_mu_ls_begin = {
  4671. init: function () {
  4672. this.jsonInit({
  4673. colour: COLOR_MU,
  4674. args0: [{
  4675. check: "String",
  4676. type: "input_value",
  4677. name: "ls_type"
  4678. }],
  4679. nextStatement: null,
  4680. previousStatement: null,
  4681. message0: Blockly.Msg.MICROBIT_MU_LS_BEGIN_MESSAGE0,
  4682. tooltip: Blockly.Msg.MICROBIT_MU_LS_BEGIN_TOOLTIP,
  4683. helpUrl: Blockly.Msg.MICROBIT_MU_LS_BEGIN_HELPURL
  4684. })
  4685. }
  4686. };
  4687. Blockly.Blocks.microbit_mu_ls_end = {
  4688. init: function () {
  4689. this.jsonInit({
  4690. colour: COLOR_MU,
  4691. args0: [{
  4692. check: "String",
  4693. type: "input_value",
  4694. name: "ls_type"
  4695. }],
  4696. nextStatement: null,
  4697. previousStatement: null,
  4698. message0: Blockly.Msg.MICROBIT_MU_LS_END_MESSAGE0,
  4699. tooltip: Blockly.Msg.MICROBIT_MU_LS_END_TOOLTIP,
  4700. helpUrl: Blockly.Msg.MICROBIT_MU_LS_END_HELPURL
  4701. })
  4702. }
  4703. };
  4704. Blockly.Blocks.microbit_mu_ls_set_sensitivity = {
  4705. init: function () {
  4706. this.jsonInit({
  4707. colour: COLOR_MU,
  4708. args0: [{
  4709. name: "sensitivity",
  4710. options: [[Blockly.Msg.MICROBIT_MU_LS_SENSITIVITY_DEFAULT, "SensitivityDefault"], [Blockly.Msg.MICROBIT_MU_LS_SENSITIVITY_1, "Sensitivity1"], [Blockly.Msg.MICROBIT_MU_LS_SENSITIVITY_2, "Sensitivity2"], [Blockly.Msg.MICROBIT_MU_LS_SENSITIVITY_3, "Sensitivity3"]],
  4711. type: "field_dropdown"
  4712. }],
  4713. nextStatement: null,
  4714. previousStatement: null,
  4715. message0: Blockly.Msg.MICROBIT_MU_LS_SET_SENSITIVITY_MESSAGE0,
  4716. tooltip: Blockly.Msg.MICROBIT_MU_LS_SET_SENSITIVITY_TOOLTIP,
  4717. helpUrl: Blockly.Msg.MICROBIT_MU_LS_SET_SENSITIVITY_HELPURL
  4718. })
  4719. }
  4720. };
  4721. Blockly.Blocks.microbit_mu_ls_wb_enable = {
  4722. init: function () {
  4723. this.jsonInit({
  4724. colour: COLOR_MU,
  4725. nextStatement: null,
  4726. previousStatement: null,
  4727. message0: Blockly.Msg.MICROBIT_MU_LS_WB_ENABLE_MESSAGE0,
  4728. tooltip: Blockly.Msg.MICROBIT_MU_LS_WB_ENABLE_TOOLTIP,
  4729. helpUrl: Blockly.Msg.MICROBIT_MU_LS_WB_ENABLE_HELPURL
  4730. })
  4731. }
  4732. };
  4733. Blockly.Blocks.microbit_mu_ls_read_proximity = {
  4734. init: function () {
  4735. this.jsonInit({
  4736. colour: COLOR_MU,
  4737. output: "Number",
  4738. message0: Blockly.Msg.MICROBIT_MU_LS_READ_PROXIMITY_MESSAGE0,
  4739. tooltip: Blockly.Msg.MICROBIT_MU_LS_READ_PROXIMITY_TOOLTIP,
  4740. helpUrl: Blockly.Msg.MICROBIT_MU_LS_READ_PROXIMITY_HELPURL
  4741. })
  4742. }
  4743. };
  4744. Blockly.Blocks.microbit_mu_ls_read_ambient_light = {
  4745. init: function () {
  4746. this.jsonInit({
  4747. colour: COLOR_MU,
  4748. output: "Number",
  4749. message0: Blockly.Msg.MICROBIT_MU_LS_READ_AMBIENT_LIGHT_MESSAGE0,
  4750. tooltip: Blockly.Msg.MICROBIT_MU_LS_READ_AMBIENT_LIGHT_TOOLTIP,
  4751. helpUrl: Blockly.Msg.MICROBIT_MU_LS_READ_AMBIENT_LIGHT_HELPURL
  4752. })
  4753. }
  4754. };
  4755. Blockly.Blocks.microbit_mu_ls_read_color = {
  4756. init: function () {
  4757. this.jsonInit({
  4758. colour: COLOR_MU,
  4759. args0: [{
  4760. name: "color_t",
  4761. options: [[Blockly.Msg.MICROBIT_MU_LS_COLOR_LABEL, "LsColorLabel"], [Blockly.Msg.MICROBIT_MU_LS_COLOR_RED, "LsColorRed"], [Blockly.Msg.MICROBIT_MU_LS_COLOR_GREEN, "LsColorGreen"], [Blockly.Msg.MICROBIT_MU_LS_COLOR_BLUE, "LsColorBlue"], [Blockly.Msg.MICROBIT_MU_LS_RAW_COLOR_RED, "LsRawColorRed"], [Blockly.Msg.MICROBIT_MU_LS_RAW_COLOR_GREEN, "LsRawColorGreen"], [Blockly.Msg.MICROBIT_MU_LS_RAW_COLOR_BLUE, "LsRawColorBlue"], [Blockly.Msg.MICROBIT_MU_LS_COLOR_HUE, "LsColorHue"], [Blockly.Msg.MICROBIT_MU_LS_COLOR_SATURATION, "LsColorSaturation"], [Blockly.Msg.MICROBIT_MU_LS_COLOR_VALUE, "LsColorValue"]],
  4762. type: "field_dropdown"
  4763. }],
  4764. output: "Number",
  4765. message0: Blockly.Msg.MICROBIT_MU_LS_READ_COLOR_MESSAGE0,
  4766. tooltip: Blockly.Msg.MICROBIT_MU_LS_READ_COLOR_TOOLTIP,
  4767. helpUrl: Blockly.Msg.MICROBIT_MU_LS_READ_COLOR_HELPURL
  4768. })
  4769. }
  4770. };
  4771. Blockly.Blocks.microbit_mu_ls_read_gesture = {
  4772. init: function () {
  4773. this.jsonInit({
  4774. colour: COLOR_MU,
  4775. output: "Number",
  4776. message0: Blockly.Msg.MICROBIT_MU_LS_READ_GESTURE_MESSAGE0,
  4777. tooltip: Blockly.Msg.MICROBIT_MU_LS_READ_GESTURE_TOOLTIP,
  4778. helpUrl: Blockly.Msg.MICROBIT_MU_LS_READ_GESTURE_HELPURL
  4779. })
  4780. }
  4781. };