pxt-calliope/libs/core/blocks-test/test.blocks
Juri Wolf 5f7a8e5301
Updates for V4 ()
* update yotta defaults for 16kb devices

* refactor deprecated blocks

* updates for button events

* update button events

* update refference

* update docs

* update docs

* update button event blocks

* update docs

* update block id
2022-08-10 09:36:19 -07:00

684 lines
69 KiB
Plaintext

<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="2w47B[B-y%SK,+8+DQGz">booltest</variable>
<variable id="Uv6@%!N7Ts}XI7t+j[zB">myImage</variable>
<variable id="7BPQp@}m*I210zEM4S=3">strtest</variable>
</variables>
<block type="pxt-on-start" x="0" y="0">
<statement name="HANDLER">
<block type="device_show_number">
<value name="number">
<shadow type="math_number">
<field name="NUM">123</field>
</shadow>
<block type="control_event_value&quot;" />
</value>
<next>
<block type="device_show_leds">
<field name="LEDS">`
# . . # .
# . . # .
. # . . .
. # # . .
. . . . .
`</field>
<next>
<block type="basic_show_icon">
<field name="i">IconNames.Heart</field>
<next>
<block type="device_pause">
<value name="pause">
<shadow type="timePicker">
<field name="ms">500</field>
</shadow>
</value>
<next>
<block type="device_clear_display">
<next>
<block type="basic_show_icon">
<field name="i">IconNames.Heart</field>
<next>
<block type="variables_set">
<field name="VAR" id="Uv6@%!N7Ts}XI7t+j[zB">myImage</field>
<value name="VALUE">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
<block type="device_build_image">
<field name="LEDS">`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`</field>
</block>
</value>
<next>
<block type="device_show_image_offset">
<value name="sprite">
<block type="variables_get">
<field name="VAR" id="Uv6@%!N7Ts}XI7t+j[zB">myImage</field>
</block>
</value>
<value name="offset">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
</value>
<next>
<block type="device_scroll_image">
<value name="sprite">
<block type="variables_get">
<field name="VAR" id="Uv6@%!N7Ts}XI7t+j[zB">myImage</field>
</block>
</value>
<value name="frameoffset">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
<block type="control_device_serial_number" />
</value>
<value name="delay">
<shadow type="math_number">
<field name="NUM">3</field>
</shadow>
</value>
<next>
<block type="variables_set">
<field name="VAR" id="7BPQp@}m*I210zEM4S=3">strtest</field>
<value name="VALUE">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
<block type="serial_read_until">
<value name="delimiter">
<shadow type="serial_delimiter_conv">
<field name="del">Delimiters.Hash</field>
</shadow>
</value>
</block>
</value>
<next>
<block type="variables_set">
<field name="VAR" id="7BPQp@}m*I210zEM4S=3">strtest</field>
<value name="VALUE">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
<block type="serial_read_buffer" />
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="device_pin_custom_event" x="2009" y="121">
<value name="eventType">
<shadow type="control_button_event_value"></shadow>
</value>
<statement name="HANDLER">
<block type="device_led_toggle">
<value name="x">
<shadow type="math_number_minmax">
<mutation min="0" max="4" label="X" precision="1" />
<field name="SLIDER">1</field>
</shadow>
</value>
<value name="y">
<shadow type="math_number_minmax">
<mutation min="0" max="4" label="Y" precision="1" />
<field name="SLIDER">2</field>
</shadow>
</value>
<next>
<block type="device_plot_bar_graph">
<value name="value">
<shadow type="math_number">
<field name="NUM">5</field>
</shadow>
</value>
<value name="high">
<shadow type="math_number">
<field name="NUM">45</field>
</shadow>
</value>
<next>
<block type="led_set_display_mode">
<field name="mode">DisplayMode.Greyscale</field>
<next>
<block type="device_set_analog_pin">
<field name="name">AnalogPin.P2</field>
<value name="value">
<shadow type="math_number_minmax">
<mutation min="0" max="1023" label="Value" />
<field name="SLIDER">1023</field>
</shadow>
<block type="device_get_analog_pin">
<field name="name">AnalogPin.P2</field>
</block>
</value>
<next>
<block type="device_set_digital_pin">
<field name="name">DigitalPin.P1</field>
<value name="value">
<shadow type="math_number_minmax">
<mutation min="0" max="1" label="Value" />
<field name="SLIDER">0</field>
</shadow>
<block type="device_get_digital_pin">
<field name="name">DigitalPin.P1</field>
</block>
</value>
<next>
<block type="device_set_analog_period">
<field name="pin">AnalogPin.P2</field>
<value name="micros">
<shadow type="math_number">
<field name="NUM">1234</field>
</shadow>
<block type="pin_map">
<value name="value">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
<block type="device_temperature" />
</value>
<value name="fromLow">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
<block type="device_heading" />
</value>
<value name="fromHigh">
<shadow type="math_number">
<field name="NUM">1023</field>
</shadow>
<block type="device_get_rotation">
<field name="NAME">Rotation.Roll</field>
</block>
</value>
<value name="toLow">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
<block type="device_get_magnetic_force">
<field name="NAME">Dimension.Y</field>
</block>
</value>
<value name="toHigh">
<shadow type="math_number">
<field name="NUM">4</field>
</shadow>
<block type="device_get_running_time" />
</value>
</block>
</value>
<next>
<block type="device_set_servo_pin">
<field name="name">AnalogPin.P2</field>
<value name="value">
<shadow type="math_number_minmax">
<mutation min="0" max="180" label="Value" />
<field name="SLIDER">180</field>
</shadow>
<block type="device_acceleration">
<field name="NAME">Dimension.Z</field>
</block>
</value>
<next>
<block type="device_set_servo_pulse">
<field name="value">AnalogPin.P2</field>
<value name="micros">
<shadow type="math_number">
<field name="NUM">1500</field>
</shadow>
<block type="device_get_light_level" />
</value>
<next>
<block type="device_play_note">
<value name="note">
<shadow type="device_note">
<field name="name">220</field>
</shadow>
</value>
<value name="duration">
<shadow type="device_beat">
<field name="fraction">BeatFraction.Sixteenth</field>
</shadow>
</value>
<next>
<block type="device_ring">
<value name="note">
<shadow type="device_note">
<field name="name">659</field>
</shadow>
</value>
<next>
<block type="device_rest">
<value name="duration">
<shadow type="device_beat">
<field name="fraction">BeatFraction.Double</field>
</shadow>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="device_gesture_event" x="1172" y="177">
<field name="NAME">Gesture.TiltLeft</field>
<statement name="HANDLER">
<block type="device_unplot">
<value name="x">
<shadow type="math_number_minmax">
<mutation min="0" max="4" label="X" precision="1" />
<field name="SLIDER">1</field>
</shadow>
<block type="control_event_value_id">
<field name="id">EventBusValue.MICROBIT_PIN_EVT_PULSE_HI</field>
</block>
</value>
<value name="y">
<shadow type="math_number_minmax">
<mutation min="0" max="4" label="Y" precision="1" />
<field name="SLIDER">2</field>
</shadow>
</value>
<next>
<block type="serial_writebuffer">
<value name="buffer">
<shadow type="serial_readbuffer">
<value name="length">
<shadow type="math_number">
<field name="NUM">64</field>
</shadow>
</value>
</shadow>
</value>
</block>
</next>
</block>
</statement>
</block>
<block type="control_in_background" x="-584" y="273">
<statement name="HANDLER">
<block type="control_wait_us">
<value name="micros">
<shadow type="math_number">
<field name="NUM">4</field>
</shadow>
<block type="control_event_timestamp&quot;" />
</value>
<next>
<block type="control_raise_event">
<value name="src">
<shadow type="control_event_source_id">
<field name="id">EventBusSource.MICROBIT_ID_IO_P0</field>
</shadow>
</value>
<value name="value">
<shadow type="control_event_value_id">
<field name="id">EventBusValue.MES_ALERT_EVT_ALARM1</field>
</shadow>
</value>
</block>
</next>
</block>
</statement>
</block>
<block type="device_forever" x="774" y="363">
<statement name="HANDLER">
<block type="variables_set">
<field name="VAR" id="2w47B[B-y%SK,+8+DQGz">booltest</field>
<value name="VALUE">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
<block type="device_get_button2">
<field name="NAME">Button.B</field>
</block>
</value>
<next>
<block type="variables_set">
<field name="VAR" id="2w47B[B-y%SK,+8+DQGz">booltest</field>
<value name="VALUE">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
<block type="device_pin_is_pressed">
<field name="NAME">TouchPin.P2</field>
</block>
</value>
<next>
<block type="variables_set">
<field name="VAR" id="2w47B[B-y%SK,+8+DQGz">booltest</field>
<value name="VALUE">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
<block type="device_point">
<value name="x">
<shadow type="math_number_minmax">
<mutation min="0" max="4" label="X" precision="1" />
<field name="SLIDER">3</field>
</shadow>
</value>
<value name="y">
<shadow type="math_number_minmax">
<mutation min="0" max="4" label="Y" precision="1" />
<field name="SLIDER">4</field>
</shadow>
</value>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="serial_on_data_received" x="-572" y="562">
<value name="delimiters">
<shadow type="serial_delimiter_conv">
<field name="del">Delimiters.Colon</field>
</shadow>
</value>
<statement name="HANDLER">
<block type="serial_redirect">
<field name="tx">SerialPin.P0</field>
<field name="rx">SerialPin.P1</field>
<field name="rate">BaudRate.BaudRate19200</field>
<next>
<block type="serial_redirect_to_usb" />
</next>
</block>
</statement>
</block>
<block type="device_button_selected_event" x="896" y="634">
<field name="NAME">Button.AB</field>
<value name="eventType">
<shadow type="control_button_event_value"></shadow>
</value>
<statement name="HANDLER">
<block type="device_plot">
<value name="x">
<shadow type="math_number_minmax">
<mutation min="0" max="4" label="X" precision="1" />
<field name="SLIDER">1</field>
</shadow>
<block type="device_beat">
<field name="fraction">BeatFraction.Sixteenth</field>
</block>
</value>
<value name="y">
<shadow type="math_number_minmax">
<mutation min="0" max="4" label="Y" precision="1" />
<field name="SLIDER">2</field>
</shadow>
</value>
<next>
<block type="device_plot_brightness">
<value name="x">
<shadow type="math_number_minmax">
<mutation min="0" max="4" label="X" precision="1" />
<field name="SLIDER">3</field>
</shadow>
<block type="device_tempo" />
</value>
<value name="y">
<shadow type="math_number_minmax">
<mutation min="0" max="4" label="Y" precision="1" />
<field name="SLIDER">5</field>
</shadow>
</value>
<value name="brightness">
<shadow type="math_number_minmax">
<mutation min="0" max="255" label="Brightness" />
<field name="SLIDER">255</field>
</shadow>
<block type="device_get_brightness" />
</value>
<next>
<block type="device_set_brightness">
<value name="value">
<shadow type="math_number_minmax">
<mutation min="0" max="255" label="Value" />
<field name="SLIDER">255</field>
</shadow>
<block type="device_note">
<field name="name">440</field>
</block>
</value>
<next>
<block type="device_stop_animation">
<next>
<block type="device_led_enable">
<value name="on">
<shadow type="logic_boolean">
<field name="BOOL">TRUE</field>
</shadow>
</value>
<next>
<block type="input_compass_calibrate" />
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="device_pin_custom_event" x="478" y="950">
<value name="eventType">
<shadow type="control_button_event_value"></shadow>
</value>
<statement name="HANDLER"></statement>
</block>
<block type="pins_on_pulsed" x="1140" y="1050">
<field name="pin">DigitalPin.P1</field>
<field name="pulse">PulseValue.Low</field>
<statement name="HANDLER">
<block type="i2c_writenumber">
<field name="format">NumberFormat.UInt8BE</field>
<value name="address">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
</value>
<value name="value">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
</value>
<value name="repeat">
<shadow type="logic_boolean">
<field name="BOOL">FALSE</field>
</shadow>
</value>
<next>
<block type="device_analog_pitch">
<value name="frequency">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
</value>
<value name="ms">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
</value>
<next>
<block type="device_set_pin_events">
<field name="pin">DigitalPin.P0</field>
<field name="type">PinEventType.Touch</field>
<next>
<block type="spi_frequency">
<value name="frequency">
<shadow type="math_number">
<field name="NUM">1000000</field>
</shadow>
</value>
<next>
<block type="device_analog_set_pitch_pin">
<field name="name">AnalogPin.P2</field>
<next>
<block type="device_set_pull">
<field name="pin">DigitalPin.P2</field>
<field name="pull">PinPullMode.PullDown</field>
<next>
<block type="spi_format">
<value name="bits">
<shadow type="math_number">
<field name="NUM">8</field>
</shadow>
</value>
<value name="mode">
<shadow type="math_number">
<field name="NUM">3</field>
</shadow>
</value>
<next>
<block type="spi_pins">
<field name="mosi">DigitalPin.P1</field>
<field name="miso">DigitalPin.P1</field>
<field name="sck">DigitalPin.P1</field>
<next>
<block type="control_reset" />
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="melody_on_event" x="461" y="1123">
<field name="value">MusicEvent.BackgroundMelodyNotePlayed</field>
<statement name="HANDLER">
<block type="device_change_tempo">
<value name="value">
<shadow type="math_number">
<field name="NUM">123</field>
</shadow>
</value>
<next>
<block type="device_set_tempo">
<value name="value">
<shadow type="math_number_minmax">
<mutation min="4" max="400" label="Bpm" precision="0" />
<field name="SLIDER">12312312</field>
</shadow>
</value>
<next>
<block type="serial_writeline">
<value name="text">
<shadow type="text">
<field name="TEXT" />
</shadow>
<block type="serial_read_line" />
</value>
<next>
<block type="serial_writenumber">
<value name="value">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
</value>
<next>
<block type="serial_writevalue">
<value name="name">
<shadow type="text">
<field name="TEXT">x</field>
</shadow>
</value>
<value name="value">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
</value>
<next>
<block type="serial_writestring">
<value name="text">
<shadow type="text">
<field name="TEXT" />
</shadow>
<block type="control_device_name" />
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="control_on_event" x="-701" y="1386">
<value name="src">
<shadow type="control_event_source_id">
<field name="id">EventBusSource.MICROBIT_ID_IO_P1</field>
</shadow>
</value>
<value name="value">
<shadow type="control_event_value_id">
<field name="id">EventBusValue.MES_ALERT_EVT_ALARM2</field>
</shadow>
</value>
</block>
</xml>