In this project, we will show you how to control the LEGO® Technic Liebherr Crawler Crane (42146) with the Powered Up (Train) Remote.

This gives you precise control over each of the crane’s functions without having to use a phone or tablet. You can drive it around with the red and grey buttons, and use the green button to switch between controlling the base and the crane functions.

This crane has two hubs, so we’ll also show you how to connect them via Bluetooth.

Driving the LEGO® Technic Liebherr Crawler Crane (42146) with the Powered Up remote.
Driving the LEGO® Technic Liebherr Crawler Crane (42146) with the Powered Up remote.

Requirements

To follow this project, you will need the following:

See this overview for all compatible models.

Understanding the code

This project has two programs, one for each hub. The hub in the base connects to the Powered Up remote and drives the vehicle. It also calculates the required speeds of the crane functions based on your input, and broadcasts these to the other hub in the crane.

The crane hub receives these messages and controls the crane functions accordingly. While the order of installation doesn’t matter, it’s practical to download and run the crane program first. Because it simply starts and stops the crane functions based on the incoming signals, you can customize all the actions in the program for the hub in the base instead.

When sending numbers, communication works best if you send small numbers. So we just send the speed values as percentages, and multiply them by a factor in the crane program to get the desired speed.

The program for the hub in the crane receives three values and sets the crane motor speed functions accordingly.
The program for the hub in the crane receives three values and sets the crane motor speed functions accordingly.
The program for the hub in the base receives the Powered Up remote input, drives and turns the base, and broadcasts the required speeds for the crane functions to the other hub. Switch to crane mode with the green button.
The program for the hub in the base receives the Powered Up remote input, drives and turns the base, and broadcasts the required speeds for the crane functions to the other hub. Switch to crane mode with the green button.

Running the Pybricks program

This project uses Pybricks on your LEGO hub. Pybricks makes your creations come alive and helps you unlock the full potential of your LEGO Technic, City, MINDSTORMS, BOOST, or Spike sets.

If you haven’t already, install Pybricks on your hub as shown below, or check out our getting started guide for more details. You can go back to the LEGO firmware and apps at any time.

Install the Pybricks firmware.
settings
install

Now import the program you downloaded earlier, as shown below. Click to connect your hub and ▶ to start!

Import a Pybricks Code project.
files
import
open
connect
run

You can run imported block programs even if you’re not signed up. This is a great way to try out Pybricks and see how it works.

In this project, you have two hubs. Installation works the same for both. During installation, you can give each hub a unique name such as Base or Crane, which makes it easier to tell them apart when you connect later.

The crane in action

When you’re ready, you can operate the crane as shown below!

Communication between the two hubs works best if you disconnect them from your computer.

Running it as a Python program

You can also run this project as a Python (MicroPython) program. The following code was generated from the block program above. To run it, create a new empty Python program in Pybricks and copy the code into it.

# pybricks blocks file:{"blocks":{"languageVersion":0,"blocks":[{"type":"blockGlobalSetup","id":"bjK,wS1MYO7aiYkFSwd{","x":172,"y":280,"deletable":false,"next":{"block":{"type":"variables_set_technic_hub","id":"gp(=11-+rR7XV,H(Kz3)","extraState":{"optionLevel":3},"fields":{"VAR":{"id":"i#u8,ZT,l2iPEM`;lnA@"},"FIELDBROADCAST":0,"FIELDOBSERVE0":5},"inputs":{"AXIS_TOP":{"shadow":{"type":"blockParametersAxis","id":"X#%3uk$HRKke7-$x61?_","fields":{"VALUE":"z"}}},"AXIS_FRONT":{"shadow":{"type":"blockParametersAxis","id":"t6svMY`f{#wcs{O_V(3m","fields":{"VALUE":"x"}}}},"next":{"block":{"type":"variables_set_motor","id":"g=O6sK{#.90KNfvnR{3l","fields":{"VAR":{"id":"._x2WX|z0x*L@Q%1?Oey"}},"inputs":{"PORT":{"shadow":{"type":"blockParametersPort","id":"D*][0)m_^se#;]?i?nE~","fields":{"NAME":"A"}}},"POSITIVE_DIRECTION":{"shadow":{"type":"blockParametersDirection","id":"ts6pK}D}12wK?-A7rdcH","fields":{"SELECTION":"Direction.CLOCKWISE"}}}},"next":{"block":{"type":"variables_set_motor","id":"$=xhOYJ^ftcYuvA1[:R8","fields":{"VAR":{"id":"$n#Nfds#E0z.%x{D?N?j"}},"inputs":{"PORT":{"shadow":{"type":"blockParametersPort","id":"p!6p@JZi%jsz4X-{UbX)","fields":{"NAME":"D"}}},"POSITIVE_DIRECTION":{"shadow":{"type":"blockParametersDirection","id":"R$^/X.)X.[ug3MtZ.A3H","fields":{"SELECTION":"Direction.CLOCKWISE"}}}},"next":{"block":{"type":"variables_set_motor","id":"$gK`*.B=^D#Sb*GM}@o0","fields":{"VAR":{"id":"OBSfiq9+`s6)T412+4--"}},"inputs":{"PORT":{"shadow":{"type":"blockParametersPort","id":"1=vO3e10f`.G2/~mNPRF","fields":{"NAME":"B"}}},"POSITIVE_DIRECTION":{"shadow":{"type":"blockParametersDirection","id":"Gzy?NnDeNd6;2}DJNrD(","fields":{"SELECTION":"Direction.CLOCKWISE"}}}},"next":{"block":{"type":"variables_setup_any","id":"PVya@6UaVs-6?tW}Lh^U","fields":{"VAR":{"id":"n_]YQ6iELb+nyPy]]+U:"}},"inputs":{"VALUE0":{"shadow":{"type":"blockMathNumber","id":"7NHOATM7n7ev6M:J{Rw+","fields":{"NUM":0}}}},"next":{"block":{"type":"variables_setup_any","id":"s9?/Lvn.hcI#=5+cLhwQ","fields":{"VAR":{"id":"8w7g{`ViwcpAD;3E!~u+"}},"inputs":{"VALUE0":{"shadow":{"type":"blockMathNumber","id":")+N/:!F`HJiBss){b=(C","fields":{"NUM":0}}}},"next":{"block":{"type":"variables_setup_any","id":"??7xH4OIC/qGE.Bmz0|,","fields":{"VAR":{"id":"vnW2nU]#v`UU)%BHG(/]"}},"inputs":{"VALUE0":{"shadow":{"type":"blockMathNumber","id":"=c?^@d/}|C$4RaHD?6+G","fields":{"NUM":0}}}}}}}}}}}}}}}}}}},{"type":"blockGlobalStart","id":"3tJe|AWl0baN(wH9a$@.","x":170,"y":754,"deletable":false,"next":{"block":{"type":"blockFlowWhile","id":"wco]@xabtlt#dtq|TrZ{","fields":{"MODE":"WHILE"},"inputs":{"BOOL":{"shadow":{"type":"blockLogicTrue","id":"@6BOn#UM|kptQ,+-Gjh#"}},"DO":{"block":{"type":"blockComment","id":"O4fq1kN78eO?UP2y1Qk_","fields":{"FIELDNAME":"Get and unpack data sent from the hub in the base.\nThis unpack block sets the variables to 0 if there is no data."},"next":{"block":{"type":"blockListUnpack","id":"307ic~W}VYEwDztNSIKY","extraState":{"optionLevel":2},"inputs":{"LIST":{"shadow":{"type":"blockListEmpty","id":"l=^}qe#UvB)UHNWUQM^/"},"block":{"type":"blockBleObserve","id":"S:,m#cHuM8(,SLiF#7[g","fields":{"CHANNEL":"5"},"inputs":{"VAR":{"shadow":{"type":"variables_get_ble_hub","id":"e`WUjEf7Ntfvks4`{c|@","fields":{"VAR":{"id":"i#u8,ZT,l2iPEM`;lnA@","name":"hub","type":"TechnicHub"}}}}}}},"VAR":{"shadow":{"type":"variables_get_any","id":"iX^`ei`?E3|I5h,Pi|;;","fields":{"VAR":{"id":"n_]YQ6iELb+nyPy]]+U:","name":"boom speed","type":"Any"}}}},"VAR0":{"shadow":{"type":"variables_get_any","id":"]|:8*jtILbfu/%Ow-Qkm","fields":{"VAR":{"id":"8w7g{`ViwcpAD;3E!~u+","name":"jib speed","type":"Any"}}}},"VAR1":{"shadow":{"type":"variables_get_any","id":"gH]G_T6ye%Ca%_LddL%H","fields":{"VAR":{"id":"vnW2nU]#v`UU)%BHG(/]","name":"hoist speed","type":"Any"}}}}},"next":{"block":{"type":"blockComment","id":"ke=P%VXY*)tfJyXzr=2F","fields":{"FIELDNAME":"Operate the boom."},"next":{"block":{"type":"blockIfElse","id":"k3VV;c{)p%qhuCO!Q1O4","extraState":{"optionLevel":1},"inputs":{"IF0":{"shadow":{"type":"blockLogicTrue","id":"hagrZ8|VDiqh3X`507iV"},"block":{"type":"blockVariableGetValue","id":"q%_{gMR,;ej9hmuxc(Z:","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"gs2rr9JyYDGSHWG`E{wW","fields":{"VAR":{"id":"n_]YQ6iELb+nyPy]]+U:","name":"boom speed","type":"Any"}}}}}}},"DO0":{"block":{"type":"blockMotorRun","id":"Zy8F:`j(*Pd2}~uu`9~M","extraState":{"optionLevel":0},"fields":{"METHOD":"MOTOR_RUN_FOREVER"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"=!DWATjX]I#!S+an,JFP","fields":{"VAR":{"id":"._x2WX|z0x*L@Q%1?Oey","name":"boom","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_angularVelocity","id":"A9mVB:Fww7!Po3Z?V|Wr","fields":{"VALUE0":500}},"block":{"type":"blockMathArithmetic","id":"`]00b5gDm2bI%y!74QS+","fields":{"OP":"MULTIPLY"},"inputs":{"A":{"shadow":{"type":"blockMathNumber","id":"$6y(Ap=O/~ruy4zVBHRO","fields":{"NUM":1}},"block":{"type":"blockVariableGetValue","id":"/~z(jh8m;vO[libomQr,","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"nsyBW]VMNn!r$Zd3+p+5","fields":{"VAR":{"id":"n_]YQ6iELb+nyPy]]+U:","name":"boom speed","type":"Any"}}}}}}},"B":{"shadow":{"type":"blockMathNumber","id":"RcIkNCI5LNMueiJR;q?=","fields":{"NUM":8}}}}}}}}},"ELSE":{"block":{"type":"blockMotorStop","id":"5Bm|]rd;,XX_!VpTYN(p","inputs":{"VAR":{"shadow":{"type":"variables_get_simple_motor_device","id":"rDO@-h#7bI6Thk_nG|7p","fields":{"VAR":{"id":"._x2WX|z0x*L@Q%1?Oey","name":"boom","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"parameters_stop_3","id":"rOqV:1Akqn5K(I?6bgJs","fields":{"VALUE":"Stop.COAST"}}}}}}},"next":{"block":{"type":"blockComment","id":"97}pMbpzKVu#}YSAQ8,/","fields":{"FIELDNAME":"Operate the jib."},"next":{"block":{"type":"blockIfElse","id":")XQv_j~Mg[D/wmh]@aMG","extraState":{"optionLevel":1},"inputs":{"IF0":{"shadow":{"type":"blockLogicTrue","id":"hagrZ8|VDiqh3X`507iV"},"block":{"type":"blockVariableGetValue","id":"O*$XNpCfyY[7MRx.OKm-","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"j*@6GMrk]!4_-C^~fY?H","fields":{"VAR":{"id":"8w7g{`ViwcpAD;3E!~u+","name":"jib speed","type":"Any"}}}}}}},"DO0":{"block":{"type":"blockMotorRun","id":"6n*#Q#][nhabD_[%ejh]","extraState":{"optionLevel":0},"fields":{"METHOD":"MOTOR_RUN_FOREVER"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"Eku[JwP/Mp?d)ah76,%.","fields":{"VAR":{"id":"$n#Nfds#E0z.%x{D?N?j","name":"jib","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_angularVelocity","id":"A9mVB:Fww7!Po3Z?V|Wr","fields":{"VALUE0":500}},"block":{"type":"blockMathArithmetic","id":"lP%#WB]{@i@MX/-fNm~$","fields":{"OP":"MULTIPLY"},"inputs":{"A":{"shadow":{"type":"blockMathNumber","id":"$6y(Ap=O/~ruy4zVBHRO","fields":{"NUM":1}},"block":{"type":"blockVariableGetValue","id":"04/)TN=be[dni~Blbg[c","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":":-kfMi@L$A@||aP%M(e+","fields":{"VAR":{"id":"8w7g{`ViwcpAD;3E!~u+","name":"jib speed","type":"Any"}}}}}}},"B":{"shadow":{"type":"blockMathNumber","id":"[XmOiM-yl{;$!WQW@2$~","fields":{"NUM":8}}}}}}}}},"ELSE":{"block":{"type":"blockMotorStop","id":"it9|R:W.Q:XqKf,Hi_D~","inputs":{"VAR":{"shadow":{"type":"variables_get_simple_motor_device","id":"N=syNkY8CFRprRsNthx%","fields":{"VAR":{"id":"$n#Nfds#E0z.%x{D?N?j","name":"jib","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"parameters_stop_3","id":"XtlFkb1[`P+umBV]f,Pt","fields":{"VALUE":"Stop.COAST"}}}}}}},"next":{"block":{"type":"blockComment","id":"ya5l*WsWRqu%38rw{_;1","fields":{"FIELDNAME":"Operate the hoist."},"next":{"block":{"type":"blockIfElse","id":"/*0VU,R@0pej=L)SC02$","extraState":{"optionLevel":1},"inputs":{"IF0":{"shadow":{"type":"blockLogicTrue","id":"hagrZ8|VDiqh3X`507iV"},"block":{"type":"blockVariableGetValue","id":"B3bKc+TB_%$2p,W5X?PN","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"HUfG,R?#|mvmFPvXlRaJ","fields":{"VAR":{"id":"vnW2nU]#v`UU)%BHG(/]","name":"hoist speed","type":"Any"}}}}}}},"DO0":{"block":{"type":"blockMotorRun","id":"v/pWVg_-^)D}s6gryM@e","extraState":{"optionLevel":0},"fields":{"METHOD":"MOTOR_RUN_FOREVER"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"r$KgiMUNAtY8uImGVg)S","fields":{"VAR":{"id":"OBSfiq9+`s6)T412+4--","name":"hoist","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_angularVelocity","id":"A9mVB:Fww7!Po3Z?V|Wr","fields":{"VALUE0":500}},"block":{"type":"blockMathArithmetic","id":"7gHoS^fq%XW,`K{e11B2","fields":{"OP":"MULTIPLY"},"inputs":{"A":{"shadow":{"type":"blockMathNumber","id":"$6y(Ap=O/~ruy4zVBHRO","fields":{"NUM":1}},"block":{"type":"blockVariableGetValue","id":"c@qG.4vl@~YKBXKs[ntC","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":")BZ--/CfD288C,Zezkvj","fields":{"VAR":{"id":"vnW2nU]#v`UU)%BHG(/]","name":"hoist speed","type":"Any"}}}}}}},"B":{"shadow":{"type":"blockMathNumber","id":",hL3:$o}kjm]$*E5hT%6","fields":{"NUM":10}}}}}}}}},"ELSE":{"block":{"type":"blockMotorStop","id":"PL^oIahHYL_w(bW!Y,fN","inputs":{"VAR":{"shadow":{"type":"variables_get_simple_motor_device","id":"z~W`Gtl`w?/Ksecv;.`[","fields":{"VAR":{"id":"OBSfiq9+`s6)T412+4--","name":"hoist","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"parameters_stop_3","id":"0o/opA(V!wbx`LrP0^Ag","fields":{"VALUE":"Stop.COAST"}}}}}}},"next":{"block":{"type":"blockWaitTime","id":"NdR7p!{d!K*L_B$SvOmI","inputs":{"VALUE0":{"shadow":{"type":"unit_time","id":"~kQ^@__a(=9ZHRGv_^Ex","fields":{"VALUE0":50}}}}}}}}}}}}}}}}}}}}}}}}}}]},"variables":[{"name":"red","id":"*k/eSiSsxc:qB)!Kqd5{","type":"ColorDef"},{"name":"orange","id":"$k6mO5?H[1`yo$d5,y)p","type":"ColorDef"},{"name":"yellow","id":"F/tUN.IV(ZU?*hYlVmef","type":"ColorDef"},{"name":"green","id":"!3RvaC?EP]fx)4Ov`w$6","type":"ColorDef"},{"name":"cyan","id":"f=Yx7-$|||Ysonu}EU(U","type":"ColorDef"},{"name":"blue","id":"V5P*Y7wk%]%;g5x8;wq[","type":"ColorDef"},{"name":"violet","id":"i7R|%ut339[(.NE0@ase","type":"ColorDef"},{"name":"magenta","id":"vu6)(D9.Fvx}];fSP9jy","type":"ColorDef"},{"name":"white","id":"T]hTr(tgkzCBL1:Wz:F#","type":"ColorDef"},{"name":"none","id":"LPHKZ{MgM40/0}Yxtc#M","type":"ColorDef"},{"name":"hub","id":"i#u8,ZT,l2iPEM`;lnA@","type":"TechnicHub"},{"name":"boom speed","id":"n_]YQ6iELb+nyPy]]+U:","type":"Any"},{"name":"jib speed","id":"8w7g{`ViwcpAD;3E!~u+","type":"Any"},{"name":"hoist speed","id":"vnW2nU]#v`UU)%BHG(/]","type":"Any"},{"name":"boom","id":"._x2WX|z0x*L@Q%1?Oey","type":"Motor"},{"name":"jib","id":"$n#Nfds#E0z.%x{D?N?j","type":"Motor"},{"name":"hoist","id":"OBSfiq9+`s6)T412+4--","type":"Motor"}],"info":{"type":"pybricks","version":"1.2.2"}}
from pybricks.hubs import TechnicHub
from pybricks.parameters import Axis, Direction, Port, Stop
from pybricks.pupdevices import Motor
from pybricks.tools import wait

# Set up all devices.
hub = TechnicHub(top_side=Axis.Z, front_side=Axis.X, broadcast_channel=0, observe_channels=[5])
boom = Motor(Port.A, Direction.CLOCKWISE)
jib = Motor(Port.D, Direction.CLOCKWISE)
hoist = Motor(Port.B, Direction.CLOCKWISE)

# Initialize variables.
boom_speed = 0
jib_speed = 0
hoist_speed = 0


# The main program starts here.
while True:
    # Get and unpack data sent from the hub in the base.
    # This unpack block sets the variables to 0 if there is no data.
    boom_speed, jib_speed, hoist_speed = hub.ble.observe(5) or [0] * 3
    # Operate the boom.
    if boom_speed:
        boom.run(boom_speed * 8)
    else:
        boom.stop()
    # Operate the jib.
    if jib_speed:
        jib.run(jib_speed * 8)
    else:
        jib.stop()
    # Operate the hoist.
    if hoist_speed:
        hoist.run(hoist_speed * 10)
    else:
        hoist.stop()
    wait(50)

Program for the crane hub.
# pybricks blocks file:{"blocks":{"languageVersion":0,"blocks":[{"type":"blockGlobalSetup","id":"bjK,wS1MYO7aiYkFSwd{","x":172,"y":280,"deletable":false,"next":{"block":{"type":"variables_set_technic_hub","id":"gp(=11-+rR7XV,H(Kz3)","extraState":{"optionLevel":2},"fields":{"VAR":{"id":"i#u8,ZT,l2iPEM`;lnA@"},"FIELDBROADCAST":5},"inputs":{"AXIS_TOP":{"shadow":{"type":"blockParametersAxis","id":"X#%3uk$HRKke7-$x61?_","fields":{"VALUE":"z"}}},"AXIS_FRONT":{"shadow":{"type":"blockParametersAxis","id":"t6svMY`f{#wcs{O_V(3m","fields":{"VALUE":"x"}}}},"next":{"block":{"type":"variables_set_remote","id":"5(ZHiLt+mTTHOz%vOYOC","extraState":{"optionLevel":0},"fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%"},"METHOD":"CONNECT_ANY"},"next":{"block":{"type":"variables_set_motor","id":"g=O6sK{#.90KNfvnR{3l","fields":{"VAR":{"id":"._x2WX|z0x*L@Q%1?Oey"}},"inputs":{"PORT":{"shadow":{"type":"blockParametersPort","id":"D*][0)m_^se#;]?i?nE~","fields":{"NAME":"C"}}},"POSITIVE_DIRECTION":{"shadow":{"type":"blockParametersDirection","id":"ts6pK}D}12wK?-A7rdcH","fields":{"SELECTION":"Direction.CLOCKWISE"}}}},"next":{"block":{"type":"variables_set_motor","id":"$=xhOYJ^ftcYuvA1[:R8","fields":{"VAR":{"id":"$n#Nfds#E0z.%x{D?N?j"}},"inputs":{"PORT":{"shadow":{"type":"blockParametersPort","id":"p!6p@JZi%jsz4X-{UbX)","fields":{"NAME":"D"}}},"POSITIVE_DIRECTION":{"shadow":{"type":"blockParametersDirection","id":"R$^/X.)X.[ug3MtZ.A3H","fields":{"SELECTION":"Direction.COUNTERCLOCKWISE"}}}},"next":{"block":{"type":"variables_set_motor","id":"$gK`*.B=^D#Sb*GM}@o0","fields":{"VAR":{"id":"OBSfiq9+`s6)T412+4--"}},"inputs":{"PORT":{"shadow":{"type":"blockParametersPort","id":"1=vO3e10f`.G2/~mNPRF","fields":{"NAME":"B"}}},"POSITIVE_DIRECTION":{"shadow":{"type":"blockParametersDirection","id":"Gzy?NnDeNd6;2}DJNrD(","fields":{"SELECTION":"Direction.CLOCKWISE"}}}},"next":{"block":{"type":"variables_setup_any","id":"s9?/Lvn.hcI#=5+cLhwQ","fields":{"VAR":{"id":"8w7g{`ViwcpAD;3E!~u+"}},"inputs":{"VALUE0":{"shadow":{"type":"blockMathNumber","id":")+N/:!F`HJiBss){b=(C","fields":{"NUM":0}}}},"next":{"block":{"type":"variables_setup_any","id":"PVya@6UaVs-6?tW}Lh^U","fields":{"VAR":{"id":"n_]YQ6iELb+nyPy]]+U:"}},"inputs":{"VALUE0":{"shadow":{"type":"blockMathNumber","id":"7NHOATM7n7ev6M:J{Rw+","fields":{"NUM":0}}}},"next":{"block":{"type":"variables_setup_any","id":"??7xH4OIC/qGE.Bmz0|,","fields":{"VAR":{"id":"vnW2nU]#v`UU)%BHG(/]"}},"inputs":{"VALUE0":{"shadow":{"type":"blockMathNumber","id":"=c?^@d/}|C$4RaHD?6+G","fields":{"NUM":0}}}}}}}}}}}}}}}}}}}}},{"type":"blockGlobalStart","id":"3tJe|AWl0baN(wH9a$@.","x":160,"y":850,"deletable":false,"next":{"block":{"type":"blockMotorConfigure","id":"o50O)HuKH^!kkl75d.j,","extraState":{"optionLevel":1},"fields":{"METHOD":"MOTOR_ACCELERATION"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"wg.FC*!eHWx@_(P-%!_!","fields":{"VAR":{"id":"._x2WX|z0x*L@Q%1?Oey","name":"left","type":"Motor"}}}},"ARG0":{"shadow":{"type":"unit_angularAcceleration","id":"lqZ6.[N9bi;1K9V!3-3!","fields":{"VALUE0":2500}}}},"next":{"block":{"type":"blockMotorConfigure","id":"B%R0SaiJaG_e,ia$?e]V","extraState":{"optionLevel":1},"fields":{"METHOD":"MOTOR_ACCELERATION"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"*Zh+cr_B?RHY={P:tuWR","fields":{"VAR":{"id":"$n#Nfds#E0z.%x{D?N?j","name":"right","type":"Motor"}}}},"ARG0":{"shadow":{"type":"unit_angularAcceleration","id":"=_=?hreur#Ke,]1Hm6[^","fields":{"VALUE0":2500}}}},"next":{"block":{"type":"blockFlowWhile","id":"wco]@xabtlt#dtq|TrZ{","fields":{"MODE":"WHILE"},"inputs":{"BOOL":{"shadow":{"type":"blockLogicTrue","id":"@6BOn#UM|kptQ,+-Gjh#"}},"DO":{"block":{"type":"blockComment","id":"CVRK0{Cu|J7)5|;pselB","fields":{"FIELDNAME":"First, we are in drive mode, where we operate the base\nusing the buttons, until you press the center button to\nchange the mode."},"next":{"block":{"type":"blockLightOnColor","id":"ZFz]_/(E)FpH/)c2rRDL","extraState":{"optionLevel":1},"fields":{"METHOD":"LIGHT_ON"},"inputs":{"VAR":{"shadow":{"type":"variables_get_color_light_device","id":"uc{-0~(IZPO@MeE@F`.t","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"COLOR":{"shadow":{"type":"variables_get_color","id":"wk{[O/tnmWQ(XOW;`T@b","fields":{"COLOUR":"#ff0000","VAR":{"id":"*k/eSiSsxc:qB)!Kqd5{","name":"red","type":"ColorDef"}}}}},"next":{"block":{"type":"blockWaitUntil","id":"%r!WNegG+.up6.a6bnn|","inputs":{"BOOL":{"shadow":{"type":"blockLogicTrue","id":"2XrX=W^wUx9u,(:GwN9~"},"block":{"type":"blockLogicIsNone","id":"`C}M~8nCJ1+No:eA?[5t","fields":{"OP":"NOT"},"inputs":{"BOOL":{"shadow":{"type":"blockLogicTrue","id":"Bfqhvit_jUJug}[/KO^}"},"block":{"type":"blockButtonIsPressed","id":"br.tXkZ[A^5l]R^`Q~c?","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"w}Z.0R`~2W7p}dX%U_6g","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":",]]@0a%*8TP?%LdXqi;U","fields":{"VALUE":"CENTER"}}}}}}}}}},"next":{"block":{"type":"blockFlowWhile","id":")XPU1ML5!B?wjvZX~iqH","fields":{"MODE":"UNTIL"},"inputs":{"BOOL":{"shadow":{"type":"blockLogicTrue","id":"T+fy{AI.b7k3c!ID([DR"},"block":{"type":"blockButtonIsPressed","id":"DslM`.$8vmP3v:(OV?=:","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"7zL0bkW=?Zo.+3GooL$7","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"xFF,WB^}-E0;QH+z1lUf","fields":{"VALUE":"CENTER"}}}}}},"DO":{"block":{"type":"blockFunctionCallerStatement","id":"I4pi|O`rj/Hs)]#|`yX)","extraState":{"optionLevel":0},"fields":{"ICON":"TASK","VAR":{"id":"n!frijC^y}T~JE:I]K*g"}},"next":{"block":{"type":"blockWaitTime","id":"0peOa],sGS}03*+KY/|r","inputs":{"VALUE0":{"shadow":{"type":"unit_time","id":"e_U0w,bSflQ8Ax3bb|+o","fields":{"VALUE0":50}}}}}}}}},"next":{"block":{"type":"blockComment","id":"x}vjQach18tJ/FU]^8[v","fields":{"FIELDNAME":"Now we are in crane operation mode. Here we stop driving and\nbroadcast the button values to the other hub, so it can operate\nthe crane functions based on your input. Until you press the\ncenter button again."},"next":{"block":{"type":"blockLightOnColor","id":"hz,}dMZA4N9XY8gMup16","extraState":{"optionLevel":1},"fields":{"METHOD":"LIGHT_ON"},"inputs":{"VAR":{"shadow":{"type":"variables_get_color_light_device","id":"V@y-HM*5+6#5qjarDF%n","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"COLOR":{"shadow":{"type":"variables_get_color","id":"{zmblx*p|}(R]%77kNn~","fields":{"COLOUR":"#00ff00","VAR":{"id":"!3RvaC?EP]fx)4Ov`w$6","name":"green","type":"ColorDef"}}}}},"next":{"block":{"type":"blockMotorStop","id":"t@D7Xc2R.$0o;Kv2u)k#","inputs":{"VAR":{"shadow":{"type":"variables_get_simple_motor_device","id":"!B/Db8A!7qdNzVU,Up|9","fields":{"VAR":{"id":"$n#Nfds#E0z.%x{D?N?j","name":"right","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"parameters_stop_3","id":"BIOR,!:-`-b}f4[0q8Jx","fields":{"VALUE":"Stop.COAST"}}}},"next":{"block":{"type":"blockMotorStop","id":"LFZ~`-%Son8_$]xWEk+,","inputs":{"VAR":{"shadow":{"type":"variables_get_simple_motor_device","id":"G1aaq(65N(5~]_#nWmV8","fields":{"VAR":{"id":"._x2WX|z0x*L@Q%1?Oey","name":"left","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"parameters_stop_3","id":"+PgY_GELChq/wt?C+W^?","fields":{"VALUE":"Stop.COAST"}}}},"next":{"block":{"type":"blockMotorStop","id":"(Or/(K*+6K3{1L-uE3v,","inputs":{"VAR":{"shadow":{"type":"variables_get_simple_motor_device","id":"tqxFI6(JXeEW)^aOf#im","fields":{"VAR":{"id":"OBSfiq9+`s6)T412+4--","name":"turntable","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"parameters_stop_3","id":"u1%5EeKuj:3vJ2M69zhL","fields":{"VALUE":"Stop.COAST"}}}},"next":{"block":{"type":"blockWaitUntil","id":"qDe`2vu(0:$]bhMKm#tg","inputs":{"BOOL":{"shadow":{"type":"blockLogicTrue","id":"2XrX=W^wUx9u,(:GwN9~"},"block":{"type":"blockLogicIsNone","id":"o=j~.;~I{9#)1MHZaw/6","fields":{"OP":"NOT"},"inputs":{"BOOL":{"shadow":{"type":"blockLogicTrue","id":"Bfqhvit_jUJug}[/KO^}"},"block":{"type":"blockButtonIsPressed","id":"JiZzpod{2YIrTi3@o(/P","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":";/x7CZz$SU8_[XMAO[hv","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"P]pEpX$DMZbhx~nSS|J)","fields":{"VALUE":"CENTER"}}}}}}}}}},"next":{"block":{"type":"blockFlowWhile","id":"sOwlLe1s@~j_[bA~l|oj","fields":{"MODE":"UNTIL"},"inputs":{"BOOL":{"shadow":{"type":"blockLogicTrue","id":"T+fy{AI.b7k3c!ID([DR"},"block":{"type":"blockButtonIsPressed","id":"d]z=L:YAyr@Q298:?I}E","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"3RQAd=hD)h2L8IdE[i${","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"K$[|2EQ^hLz8HC`3K^#*","fields":{"VALUE":"CENTER"}}}}}},"DO":{"block":{"type":"blockVariableSetValue","id":"g=BN0c8d`P*eV.XFl:Q1","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"Z/OYALcQ87[]7s:^@H@b","fields":{"VAR":{"id":"8w7g{`ViwcpAD;3E!~u+","name":"boom speed","type":"Any"}}}},"VALUE0":{"shadow":{"type":"blockMathNumber","id":"9-O:XmUA((~_:LDWlX2O","fields":{"NUM":0}},"block":{"type":"blockLogicTernaryDouble","id":"npG*+NOv8Yh,^WmNJOt4","inputs":{"VAL_A":{"shadow":{"type":"blockMathNumber","id":"KaF=L0Ca43km3y^,bVrd","fields":{"NUM":100}}},"IF_0":{"shadow":{"type":"blockLogicTrue","id":"$xEP.5fN9]3n.![,l6n^"},"block":{"type":"blockButtonIsPressed","id":"}$TV8tMWX),s/bw2XbFG","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"TyCON^:;rD;6yu(R%pI9","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"2dKgeqD6)92s/Yhb|wRr","fields":{"VALUE":"LEFT_PLUS"}}}}}},"VAL_B":{"shadow":{"type":"blockMathNumber","id":"UliAM:mh$4nr7]XeWEaN","fields":{"NUM":-100}}},"IF_1":{"shadow":{"type":"blockLogicTrue","id":"-e_WJDMnngR%oU:4W$l}"},"block":{"type":"blockButtonIsPressed","id":"CMw^@fw9Eat~?Zxa[rh9","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"}6%:Q3JtnSlb6A%`Z,=s","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"VWVOw96C9++3Qt1.o0e2","fields":{"VALUE":"LEFT_MINUS"}}}}}},"VAL_C":{"shadow":{"type":"blockMathNumber","id":"Yd7@:_nyEf8fF8oVgZ{T","fields":{"NUM":0}}}}}}},"next":{"block":{"type":"blockVariableSetValue","id":"`HaQhR;*|tJj#axb4GU%","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"j5?};JGa?2Sh85Q}wM7j","fields":{"VAR":{"id":"n_]YQ6iELb+nyPy]]+U:","name":"jib speed","type":"Any"}}}},"VALUE0":{"shadow":{"type":"blockMathNumber","id":"9-O:XmUA((~_:LDWlX2O","fields":{"NUM":0}},"block":{"type":"blockLogicTernaryDouble","id":"0PG`v:BOjgn{W}{[Ko~3","inputs":{"VAL_A":{"shadow":{"type":"blockMathNumber","id":"_QI1-bG0N^lI:7ob1X}}","fields":{"NUM":100}}},"IF_0":{"shadow":{"type":"blockLogicTrue","id":"$xEP.5fN9]3n.![,l6n^"},"block":{"type":"blockButtonIsPressed","id":"sD_R]#emCKRGU?Ns;,iI","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"+l60_d:}Xr.S3:pdD8=c","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"Ke*s2pFnr3B4~ySa.5Xw","fields":{"VALUE":"RIGHT_PLUS"}}}}}},"VAL_B":{"shadow":{"type":"blockMathNumber","id":"QAF_upZhA1s`?|bVN9I?","fields":{"NUM":-100}}},"IF_1":{"shadow":{"type":"blockLogicTrue","id":"-e_WJDMnngR%oU:4W$l}"},"block":{"type":"blockButtonIsPressed","id":";^(v7hN5~-^oMtJQkQfx","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"JHxgm/7FZD?JcOt7O?JJ","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"$j!*hvn%8PyW;a53DW^]","fields":{"VALUE":"RIGHT_MINUS"}}}}}},"VAL_C":{"shadow":{"type":"blockMathNumber","id":"!hwB+7?#KIl~EC`il@5=","fields":{"NUM":0}}}}}}},"next":{"block":{"type":"blockVariableSetValue","id":"DI9:v_l3u=hQ_rI^C_Dp","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"[}e5HeZEufpR%`~3|t9f","fields":{"VAR":{"id":"vnW2nU]#v`UU)%BHG(/]","name":"hoist speed","type":"Any"}}}},"VALUE0":{"shadow":{"type":"blockMathNumber","id":"9-O:XmUA((~_:LDWlX2O","fields":{"NUM":0}},"block":{"type":"blockLogicTernaryDouble","id":",.fbyK9:HMTD-r;@-[gk","inputs":{"VAL_A":{"shadow":{"type":"blockMathNumber","id":"o112W[FYVeuBGl#8yLEZ","fields":{"NUM":100}}},"IF_0":{"shadow":{"type":"blockLogicTrue","id":"$xEP.5fN9]3n.![,l6n^"},"block":{"type":"blockButtonIsPressed","id":"ue*k_`%=aq:[sjxFUBRS","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"1jXKFBFpzUFWx3!?zaHS","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"/6azmDj~kOzzW_oQiIXV","fields":{"VALUE":"RIGHT"}}}}}},"VAL_B":{"shadow":{"type":"blockMathNumber","id":"RBg+AASXiib;E]un14y:","fields":{"NUM":-100}}},"IF_1":{"shadow":{"type":"blockLogicTrue","id":"-e_WJDMnngR%oU:4W$l}"},"block":{"type":"blockButtonIsPressed","id":"NQt]`Pb?Z[*$Q1.UUUU/","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"/O0}S5pua|bk_gAl7ueK","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"Mtj`3dY`mPyaYE[Y*fk]","fields":{"VALUE":"LEFT"}}}}}},"VAL_C":{"shadow":{"type":"blockMathNumber","id":"$1tmiXFp}ZnP]dxf^):$","fields":{"NUM":0}}}}}}},"next":{"block":{"type":"blockBleBroadcast","id":"nx?~|q{?h1)@cUnQOH.w","inputs":{"VAR":{"shadow":{"type":"variables_get_ble_hub","id":"hU1.iJ)d6.(mDb}Sy[rs","fields":{"VAR":{"id":"i#u8,ZT,l2iPEM`;lnA@","name":"hub","type":"TechnicHub"}}}},"VALUE0":{"shadow":{"type":"blockMathNumber","id":"iS%ywNK14,1ny4aC`%MW","fields":{"NUM":0}},"block":{"type":"blockListCreate","id":"Ma{nzo3_N{P-*;%g4=P`","extraState":{"optionLevel":3},"inputs":{"ADD0":{"shadow":{"type":"blockMathNumber","id":"6QXX)VFsrMqxe^}X5XS%","fields":{"NUM":0}},"block":{"type":"blockVariableGetValue","id":"%E1~d,/@HbV;HGTF+@:b","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"gVz2/,ZdIT^EV[v9CF#9","fields":{"VAR":{"id":"8w7g{`ViwcpAD;3E!~u+","name":"boom speed","type":"Any"}}}}}}},"ADD1":{"shadow":{"type":"blockMathNumber","id":"+(U*w~i$lC7;#Ge~1}|3","fields":{"NUM":0}},"block":{"type":"blockVariableGetValue","id":"Dw1#@;RRj]2ZR%F-OXvn","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"p(MR25QI1wG[wB0sRD$%","fields":{"VAR":{"id":"n_]YQ6iELb+nyPy]]+U:","name":"jib speed","type":"Any"}}}}}}},"ADD2":{"shadow":{"type":"blockMathNumber","id":"FZqOE,xov)on)jP1yUkq","fields":{"NUM":0}},"block":{"type":"blockVariableGetValue","id":"^VU[:Pr4S1S*QNe!jf`N","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"^}z/wy7=Z`*U[_8F^BL6","fields":{"VAR":{"id":"vnW2nU]#v`UU)%BHG(/]","name":"hoist speed","type":"Any"}}}}}}}}}}},"next":{"block":{"type":"blockWaitTime","id":"GeY5}[g=jnv#s-%7nJ]u","inputs":{"VALUE0":{"shadow":{"type":"unit_time","id":"duz7]AaE4[1-(TB}KUF=","fields":{"VALUE0":50}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},{"type":"variables_setup_function","id":"x+X4rykX:g{?:CR*-GU{","x":937,"y":303,"extraState":{"optionLevel":0},"fields":{"ICON":"TASK","VAR":{"id":"n!frijC^y}T~JE:I]K*g"}},"inputs":{"STACK":{"block":{"type":"blockComment","id":"5Bh-a6qu?]*v2l`Wn4PA","fields":{"FIELDNAME":"Use the left/right red buttons for the turntable motor."},"next":{"block":{"type":"blockIfElse","id":"m[7!gY%:0sA;wz;L`f[f","extraState":{"optionLevel":2},"inputs":{"IF0":{"shadow":{"type":"blockLogicTrue","id":"qPOUxH-_+tQqHLYIeiun"},"block":{"type":"blockButtonIsPressed","id":"x@xXHgbD(0dtC3xF129j","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"^iw}wvDkvd{lz1towzgD","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"[f0CKh4zgq-GT]%][72J","fields":{"VALUE":"LEFT"}}}}}},"DO0":{"block":{"type":"blockMotorRun","id":"AwTEHhwI|j^5CUDqp|{C","extraState":{"optionLevel":0},"fields":{"METHOD":"MOTOR_RUN_FOREVER"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"PNd2zq:tJHNBCtkv,(YW","fields":{"VAR":{"id":"OBSfiq9+`s6)T412+4--","name":"turntable","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_angularVelocity","id":"}{!89ve,XBtl6*?U]!w;","fields":{"VALUE0":1000}}}}}},"IF1":{"shadow":{"type":"blockLogicTrue","id":"KkiFi.!:PF,jzHmdfMf4"},"block":{"type":"blockButtonIsPressed","id":"dE5}jm,^cp@wb2_(_9`k","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"=(hb$G2K}i?`nimF/eYV","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"AYi.q]%In#9B|a1QD7vj","fields":{"VALUE":"RIGHT"}}}}}},"DO1":{"block":{"type":"blockMotorRun","id":"za:B^IA^4zzc$Q|2`iD[","extraState":{"optionLevel":0},"fields":{"METHOD":"MOTOR_RUN_FOREVER"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"LQAuGLv.0xJG7NcSqWuT","fields":{"VAR":{"id":"OBSfiq9+`s6)T412+4--","name":"turntable","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_angularVelocity","id":"$L[*Zm=F7vR)Vr3hz^;#","fields":{"VALUE0":-1000}}}}}},"ELSE":{"block":{"type":"blockMotorStop","id":"}%m%5g$ux7bK0drb=NK]","inputs":{"VAR":{"shadow":{"type":"variables_get_simple_motor_device","id":"4x)i@*nv{k.8hbuVHd+O","fields":{"VAR":{"id":"OBSfiq9+`s6)T412+4--","name":"turntable","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"parameters_stop_3","id":"q=S.ws:}$|ZgLT*A`mI7","fields":{"VALUE":"Stop.COAST"}}}}}}},"next":{"block":{"type":"blockComment","id":"!K#!17~48wE^*fhi`tJL","fields":{"FIELDNAME":"Use the left +/- for the left track."},"next":{"block":{"type":"blockIfElse","id":"ixTF.]SHL)ilnZT%(=gk","extraState":{"optionLevel":2},"inputs":{"IF0":{"shadow":{"type":"blockLogicTrue","id":"qPOUxH-_+tQqHLYIeiun"},"block":{"type":"blockButtonIsPressed","id":"9eDKjt#r@MtbV?:AO!bG","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"VLJ.5R;/C+SaRu|@h@.H","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"[=aMJ-h!H(iI/*^?pJ.g","fields":{"VALUE":"LEFT_PLUS"}}}}}},"DO0":{"block":{"type":"blockMotorRun","id":"o?h|jBpWa(+0%;-$p42y","extraState":{"optionLevel":0},"fields":{"METHOD":"MOTOR_RUN_FOREVER"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"(wesG#=HS=:aKk?!}sJ9","fields":{"VAR":{"id":"._x2WX|z0x*L@Q%1?Oey","name":"left","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_angularVelocity","id":"YLv^6}SMC(hGYh.*Lgqh","fields":{"VALUE0":1000}}}}}},"IF1":{"shadow":{"type":"blockLogicTrue","id":"KkiFi.!:PF,jzHmdfMf4"},"block":{"type":"blockButtonIsPressed","id":"@B(.E-E3_I6^2atJcX`%","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":";T*3nOfBb_@_OT1e@Rnu","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"C-P-3(uM9a,O?dJ=nE?h","fields":{"VALUE":"LEFT_MINUS"}}}}}},"DO1":{"block":{"type":"blockMotorRun","id":"Mj-x)qX)dxbLyUKA+{lL","extraState":{"optionLevel":0},"fields":{"METHOD":"MOTOR_RUN_FOREVER"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":":_M~X54qEF7_R8,I[PM:","fields":{"VAR":{"id":"._x2WX|z0x*L@Q%1?Oey","name":"left","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_angularVelocity","id":"xoTv]sgw#Lh}X6do_^J9","fields":{"VALUE0":-1000}}}}}},"ELSE":{"block":{"type":"blockMotorStop","id":"(;Cib4g1vI6Z|QlyyAL*","inputs":{"VAR":{"shadow":{"type":"variables_get_simple_motor_device","id":"Tbzhp1+JM`8K1`8M/Je5","fields":{"VAR":{"id":"._x2WX|z0x*L@Q%1?Oey","name":"left","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"parameters_stop_3","id":"g[O;h*V%i@@ARsW,y-zS","fields":{"VALUE":"Stop.COAST"}}}}}}},"next":{"block":{"type":"blockComment","id":"i(xy`IQS=Q4lB#F/ZqoH","fields":{"FIELDNAME":"Use the right +/- for the left track."},"next":{"block":{"type":"blockIfElse","id":"wbyT#t{^epvp[~Eo_Bw%","extraState":{"optionLevel":2},"inputs":{"IF0":{"shadow":{"type":"blockLogicTrue","id":"qPOUxH-_+tQqHLYIeiun"},"block":{"type":"blockButtonIsPressed","id":"=BNh=Dg1}_7t,wzsW[fM","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":"tXq#|4CfC7JHR$K(NHq)","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"OB1O61O=BeBhcMi`{)f5","fields":{"VALUE":"RIGHT_PLUS"}}}}}},"DO0":{"block":{"type":"blockMotorRun","id":"]|Vz%t2~B5N1_v1,KoT0","extraState":{"optionLevel":0},"fields":{"METHOD":"MOTOR_RUN_FOREVER"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"Ag|3WZjlF.U#~9~~BjC:","fields":{"VAR":{"id":"$n#Nfds#E0z.%x{D?N?j","name":"right","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_angularVelocity","id":"!IVFKnp[_NN*dO4{Ky,D","fields":{"VALUE0":1000}}}}}},"IF1":{"shadow":{"type":"blockLogicTrue","id":"KkiFi.!:PF,jzHmdfMf4"},"block":{"type":"blockButtonIsPressed","id":"X7ICqD9alzb).7@+5k-@","inputs":{"VAR":{"shadow":{"type":"variables_get_keypad","id":")p2RWTVVSR`QL#@o|EdL","fields":{"VAR":{"id":"s6)-4b5([mxZKHR)}6$%","name":"remote","type":"Remote"}}}},"VALUE0":{"shadow":{"type":"blockParametersButton","id":"-jTwyCmC_wZs~y9U.Qu?","fields":{"VALUE":"RIGHT_MINUS"}}}}}},"DO1":{"block":{"type":"blockMotorRun","id":"J8(2P5aNmm[BALbUI~g+","extraState":{"optionLevel":0},"fields":{"METHOD":"MOTOR_RUN_FOREVER"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"a$}C]al0c@bo6pE@OV9L","fields":{"VAR":{"id":"$n#Nfds#E0z.%x{D?N?j","name":"right","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_angularVelocity","id":"Gyf`7-.ftq9wNMZtMjRe","fields":{"VALUE0":-1000}}}}}},"ELSE":{"block":{"type":"blockMotorStop","id":"HJ29R/djYiWAMl6$lAiU","inputs":{"VAR":{"shadow":{"type":"variables_get_simple_motor_device","id":"aI6NFUD$1k5tfy(Q-V-L","fields":{"VAR":{"id":"$n#Nfds#E0z.%x{D?N?j","name":"right","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"parameters_stop_3","id":"#v4;gZyWP*TJro]{6]%s","fields":{"VALUE":"Stop.COAST"}}}}}}}}}}}}}}}}}}}}}]},"variables":[{"name":"red","id":"*k/eSiSsxc:qB)!Kqd5{","type":"ColorDef"},{"name":"orange","id":"$k6mO5?H[1`yo$d5,y)p","type":"ColorDef"},{"name":"yellow","id":"F/tUN.IV(ZU?*hYlVmef","type":"ColorDef"},{"name":"green","id":"!3RvaC?EP]fx)4Ov`w$6","type":"ColorDef"},{"name":"cyan","id":"f=Yx7-$|||Ysonu}EU(U","type":"ColorDef"},{"name":"blue","id":"V5P*Y7wk%]%;g5x8;wq[","type":"ColorDef"},{"name":"violet","id":"i7R|%ut339[(.NE0@ase","type":"ColorDef"},{"name":"magenta","id":"vu6)(D9.Fvx}];fSP9jy","type":"ColorDef"},{"name":"white","id":"T]hTr(tgkzCBL1:Wz:F#","type":"ColorDef"},{"name":"none","id":"LPHKZ{MgM40/0}Yxtc#M","type":"ColorDef"},{"name":"left","id":"._x2WX|z0x*L@Q%1?Oey","type":"Motor"},{"name":"right","id":"$n#Nfds#E0z.%x{D?N?j","type":"Motor"},{"name":"turntable","id":"OBSfiq9+`s6)T412+4--","type":"Motor"},{"name":"remote","id":"s6)-4b5([mxZKHR)}6$%","type":"Remote"},{"name":"hub","id":"i#u8,ZT,l2iPEM`;lnA@","type":"TechnicHub"},{"name":"jib speed","id":"n_]YQ6iELb+nyPy]]+U:","type":"Any"},{"name":"boom speed","id":"8w7g{`ViwcpAD;3E!~u+","type":"Any"},{"name":"hoist speed","id":"vnW2nU]#v`UU)%BHG(/]","type":"Any"},{"name":"drive using the buttons","id":"n!frijC^y}T~JE:I]K*g","type":"Function"}],"info":{"type":"pybricks","version":"1.2.2"}}
from pybricks.hubs import TechnicHub
from pybricks.parameters import Axis, Button, Color, Direction, Port, Stop
from pybricks.pupdevices import Motor, Remote
from pybricks.tools import wait

# Set up all devices.
hub = TechnicHub(top_side=Axis.Z, front_side=Axis.X, broadcast_channel=5)
left = Motor(Port.C, Direction.CLOCKWISE)
right = Motor(Port.D, Direction.COUNTERCLOCKWISE)
turntable = Motor(Port.B, Direction.CLOCKWISE)
remote = Remote(timeout=None)

# Initialize variables.
boom_speed = 0
jib_speed = 0
hoist_speed = 0

def drive_using_the_buttons():
    # Use the left/right red buttons for the turntable motor.
    if Button.LEFT in remote.buttons.pressed():
        turntable.run(1000)
    elif Button.RIGHT in remote.buttons.pressed():
        turntable.run(-1000)
    else:
        turntable.stop()
    # Use the left +/- for the left track.
    if Button.LEFT_PLUS in remote.buttons.pressed():
        left.run(1000)
    elif Button.LEFT_MINUS in remote.buttons.pressed():
        left.run(-1000)
    else:
        left.stop()
    # Use the right +/- for the left track.
    if Button.RIGHT_PLUS in remote.buttons.pressed():
        right.run(1000)
    elif Button.RIGHT_MINUS in remote.buttons.pressed():
        right.run(-1000)
    else:
        right.stop()


# The main program starts here.
left.control.limits(acceleration=2500)
right.control.limits(acceleration=2500)
while True:
    # First, we are in drive mode, where we operate the base
    # using the buttons, until you press the center button to
    # change the mode.
    remote.light.on(Color.RED)
    while Button.CENTER in remote.buttons.pressed():
        wait(1)
    while not Button.CENTER in remote.buttons.pressed():
        drive_using_the_buttons()
        wait(50)
    # Now we are in crane operation mode. Here we stop driving and
    # broadcast the button values to the other hub, so it can operate
    # the crane functions based on your input. Until you press the
    # center button again.
    remote.light.on(Color.GREEN)
    right.stop()
    left.stop()
    turntable.stop()
    while Button.CENTER in remote.buttons.pressed():
        wait(1)
    while not Button.CENTER in remote.buttons.pressed():
        boom_speed = 100 if Button.LEFT_PLUS in remote.buttons.pressed() else (-100 if Button.LEFT_MINUS in remote.buttons.pressed() else 0)
        jib_speed = 100 if Button.RIGHT_PLUS in remote.buttons.pressed() else (-100 if Button.RIGHT_MINUS in remote.buttons.pressed() else 0)
        hoist_speed = 100 if Button.RIGHT in remote.buttons.pressed() else (-100 if Button.LEFT in remote.buttons.pressed() else 0)
        hub.ble.broadcast([boom_speed, jib_speed, hoist_speed])
        wait(50)

Program for the base hub.