From a0ab78402130cbd18f880ee841fe9753745eedb6 Mon Sep 17 00:00:00 2001 From: wwj718 Date: Wed, 3 Jan 2024 19:13:17 +0800 Subject: [PATCH] add microblocks_messaging_library --- libraries/LIBRARIES | 1 + libraries/microblocks_messaging_library.xml | 1 + sw.js | 4 ++++ 3 files changed, 6 insertions(+) create mode 100644 libraries/microblocks_messaging_library.xml diff --git a/libraries/LIBRARIES b/libraries/LIBRARIES index 8f2443f9d1..85e34a23ab 100644 --- a/libraries/LIBRARIES +++ b/libraries/LIBRARIES @@ -46,3 +46,4 @@ TuneScope.xml TuneScope Music Notation, Instruments, Drums, Tones, Chords, Track serial_module.xml Serial Ports Connect to hardware extensions through the Web Serial API (Chromium, Chrome or Edge required) mqtt.xml MQTT (Message Queuing Telemetry Transport) protocol for connecting with IOT devices and/or other software signada.xml Signada (Network remote control) Interact with MicroBlocks devices via WiFi. Requires the device to have a TFT display, two buttons and WiFi capability, as well as the Signada MicroBlocks project loaded. The Citilab ED1 and a bunch of the M5Stack boards are some of the devices that work with Signada. +microblocks_messaging_library.xml MicroBlocks (MicroBlocks and Snap! Communication with Messages) Snap! and MicroBlocks can exchange string messages over a USB cable using WebSerial. Messages are a flexible communciation mechanism that can be used in many ways. diff --git a/libraries/microblocks_messaging_library.xml b/libraries/microblocks_messaging_library.xml new file mode 100644 index 0000000000..280790db44 --- /dev/null +++ b/libraries/microblocks_messaging_library.xml @@ -0,0 +1 @@ +
*2cmd1250i3i1
zh_CN:MicroBlocks 连接 mb_buffermb_port115200mb_buffer
zh_CN:MicroBlocks 断开连接 mb_port0mb_buffer0
zh_CN:MicroBlocks 广播 _ 254
zh_CN:MicroBlocks 消息处理 _ _ For each broadcast message:Got some data! Process it...
Write to the port a list containing numbers
port
port
1152009600 19200 38400 57600 115200
Close port.
port
This block reports the value of the variable with the name given. It looks for that variable following the scope order 'script' -> 'sprite' -> 'global' (the first match it finds). If that variable does not exist (in any scope) an error happens, stopping their script. You can check it before using the "does var (name) exists?" block.
pt:o valor de _ §_getVarNamesDict
This block reports "true" if there is a variable with this given name (input slot) in that context. It can be a global, sprite or script variable. Otherwise it reports "false".
pt:a variável _ existe ca:existeix la variable _ ? es:existe la variable _ ? de:existiert var _ ? err_reset
This block turns on (show) the watcher view on stage (if it was not already activated) of the variable with the given name (slot input). It can only access to the closest variable scope (if there different variables with the same name in different scopes) following the order 'script' -> 'sprite' -> 'global'. No errors if that variable does not exist.
ca:mostra la variable _ es:mostrar variable _ pt:mostra a variável _ de:zeige var _ §_getVarNamesDict
This block turns off (hide) the watcher view on stage (if it was not already activated) of the variable with the given name (slot input). It can only access to the closest variable scope (if there different variables with the same name in different scopes) following the order 'script' -> 'sprite' -> 'global'. No errors if that variable does not exist.
ca:amaga la variable _ es:esconder variable _ pt:esconde a variável _ de:verstecke var _ §_getVarNamesDict
This block creates new variables on the selected scope: global (for all sprites), sprite (for this sprite only) or script (only for that blocks stack) with the names given (in 'names' list). If there is already a variable with that name in that scope, it does nothing: no errors and no overwrites.
pt:cria as variáveis _ _ ca:crea les _ variables _ es:crear las _ variables _ de:erstellen _ var _ globalglobal sprite script
This block deletes all the variables with the names given (inside input list). Each name will make only one variable deletion, and this will be the variable found following the scope order: 'script' -> 'sprite' -> 'global'. If we have a "testing" sprite variable and also a "testing" global one, deleting "testing" will delete only the sprite one (Yes! we can also do "delete var (testing, testing)" to delete both. If one variable does not exists (in any scope) an error happens, stopping block action in that point. You can check it before with the "does var (name) exists?"block.
pt:remove as variáveis _ ca:esborra les variables _ es:borrar variables _ de:löschen var _
This block sets the given value (last input) to the variable named with the name givent (var input). It looks for that variable following the scope order 'script' -> 'sprite' -> 'global' (the first match it finds). If that variable does not exist (in any scope) an error happens, stopping their script. You can check it before using the "does var (name) exists?" block.
ca:assigna a _ el valor _ es:asignar a _ el valor _ pt:altera _ para _ de:setze var _ auf _ §_getVarNamesDict
00
\ No newline at end of file diff --git a/sw.js b/sw.js index 3f4523e7c6..d5aac5aa68 100644 --- a/sw.js +++ b/sw.js @@ -170,6 +170,10 @@ var snapVersion = '10-231222-dev', 'libraries/word-sentence.xml', 'libraries/words_module.xml', + // codelab + 'libraries/microblocks_messaging_library.xml', + + //costumes 'Costumes/COSTUMES',