Jump to content
THIS IS THE TEST SITE OF EUROBRICKS! ×
THIS IS THE TEST SITE OF EUROBRICKS!

Recommended Posts

Posted (edited)

Hi,

Herewith I would like to present my modern day interpretation of the classic 8480 Spaceshuttle:

53030866406_5b3f59994c_c.jpg
I started this model already 2020 (!) based on the idea that I could use the PU motor to select four positions in a function selector gearbox. In each position I can then run two functions simultaneously by adding two more motors. At the time I had the naive hope that LEGO would provide a proper PU development environment where I could make and share profiles with others. That never happened as we all know... So after a few years of waiting I decided to redesign the model for PF motors as well. The function selection now needs to be done manually as the PF servo motor can only be used for three positions and not four, so that couldn't be used.

The functions are thus divided in four groups:

- Landing gear bay doors + Landing gear
- Cargo doors + Robot arm lift
- Robot arm rotation + Satelite solarcells
- Pitch controls + Roll controls

Here is a simple gif to show the landing gear and landing gear bay doors in open and closed position:

The cargobay is jampacked with the PU box, the robotarm and a satelite:
53031037669_7ef4000580_c.jpg

The robotarm can rotate and lift, and the solarpanels can fold themselves out with a double hinge mechanism.

In the PF version the batterybox is moved into the stand as it didn't fit inside the cargobay. In hindsight that would have been a more elegant solution for the PU version as well, but at the time I wanted to keep everything inside the model, just like the 8480 version.

The pitch & roll controls use a mechanical subtractor mechanism to combine the two signals to move the elevons on the back of the wings.

53030866386_bf179af5f9_c.jpg

All in all it was a very interesting model to design. The function density is super high, which I always like. Too bad that the PU support has been so lackluster. A friend of mine has made a fantastic control profile in the SBrickPro application, but sadly also that application is still in beta and profiles can't be shared.

53031396883_3e1d03aa7b_c.jpg

 

Thoughts, comments and feedback is welcome as always.

Oh, and instructions are available on my website for both versions.

Edited by Jeroen Ottens
Posted

I remember there was a WIP thread on this project some time ago - long time ago actually, it seems. It turned out great, glad you managed to finish it! It's a cool modern take on one of my favourite childhood sets.

I (still) think the tail fin looks a bit odd being open like this and can use some surface. The original model also has it open like that, but as that isn't panelled up, it doesn't stand out as much. But I understand the shape makes that difficult, I'm sure you tried.

Having the battery box/hub inside is good for playability. Is it swoosh-able? 

The SBrickPro app is a nice touch. What does the unlabelled up-down lever on the left of the "arm control" joystick do? Is it for unfolding of the satellite solar panels?

Posted

Great job again. While you should be proud of your ability to add and implements so many different functions in your MOCs, I'm always impressed with your ability to use panels to shape bodywork. I love the way the black and white panels work together on this MOC, and the shaping of the wings and nose looks great.

Again, another great MOC. Congratulations. 

Posted

Brilliant Design and Integration, as usual.

I feel the same thing about the control profile. We are in a rough terrain, with a PoweredUp App which lack a lot of sharing functions, and the other solutions which is for sale, so not easy to share easily our work with people !

  • 7 months later...
Posted (edited)

Hi, everyone,

As @Pybricks recently introduced native support of the XBOX wireless gamepad to the Technic PoweredUP Hub,
I thought this was a great opportunity to test it with this great model.

I decided it was worth sharing the code, which enables control of all the space shuttle's functions via gamepad (no smartphone required).

 

TL, DR -> Here is a Demo video.

 

Explanation of the controlling program:

Switching between the functions is done via the game pad "D-PAD".
Powering each of the drive motors (Motor A and Motor B) is done via the left and right thumb-sticks vertical movement (up and down). Horizontal movement is not used at all as input.
The speed of the motors can be precisely controlled in both directions thanks to the analog output of the thumb sticks.

 
pos. id Selector pos. Xbox D-pad # degrees Hub light color Motor A Motor B
p4 up 1 - 135 red landing gear landing geardoors
p3 right 3 - 45 yellow ailerons ailerons 2
p2 down 5 + 45 green solar panels arm rotation
p1 left 7 + 135 blue arm raise cargo bay door
 
Motor Mappings:
A port Motor A
B port Motor B
C port Selector motor

 

The Code:

Since I cannot directly upload the .py file as attachment, I am pasting the python code below.

You can simply copy & paste it into the browser-based Pybricks programming environment to use it.

it is pretty self explanatory, and surely it can be improved upon.

The variable "position" corresponds to the degrees value the selector needs to switch to.
Note: In the set-up phase, the "Car with steering ..." block calibrates the selector motor from end-stop to end-stop, returns to center and set this position to "zero".

# pybricks blocks file:{"blocks":{"languageVersion":0,"blocks":[{"type":"blockGlobalSetup","id":"bjK,wS1MYO7aiYkFSwd{","x":-656,"y":20,"deletable":false,"next":{"block":{"type":"variables_set_xbox_controller","id":";QJx?17:.4@1+b:2X~?[","fields":{"VAR":{"id":"g,=jtze%JV!E9QQ9y;9P"}},"next":{"block":{"type":"variables_set_technic_hub","id":"?mFLmlo#(x_@X(mU66/u","extraState":{"optionLevel":0},"fields":{"VAR":{"id":"|2j?OJJ@}Lr;v!]9Dd`N"}},"next":{"block":{"type":"variables_set_motor","id":"Z~|_BOg)4(F;OvgBDXOw","fields":{"VAR":{"id":"5HU%28@!jf]8vmM^,^47"}},"inputs":{"PORT":{"shadow":{"type":"blockParametersPort","id":"G_Yx;7jH{1Leem*@?`N,","fields":{"NAME":"A"}}},"POSITIVE_DIRECTION":{"shadow":{"type":"blockParametersDirection","id":"g8yYXUp20|^niecAk|-h","fields":{"SELECTION":"Direction.CLOCKWISE"}}}},"next":{"block":{"type":"variables_set_motor","id":"7RYh36)+RMZhcvUX3b*5","fields":{"VAR":{"id":"#]whAf15rbW_He}x+Elh"}},"inputs":{"PORT":{"shadow":{"type":"blockParametersPort","id":"gGZcIfLc-n9wD7zvq0Y1","fields":{"NAME":"B"}}},"POSITIVE_DIRECTION":{"shadow":{"type":"blockParametersDirection","id":"=1@Iww+/=*HDt,WWxBt=","fields":{"SELECTION":"Direction.CLOCKWISE"}}}},"next":{"block":{"type":"variables_set_motor","id":"5N-Cir,ix#t.w.YzrE%#","fields":{"VAR":{"id":"O@jZR`(J23rp@~@jkkhi"}},"inputs":{"PORT":{"shadow":{"type":"blockParametersPort","id":"6=3;Ql{HT.Btu)x.7!Zo","fields":{"NAME":"C"}}},"POSITIVE_DIRECTION":{"shadow":{"type":"blockParametersDirection","id":"%)H%-7,`i4c_;PFKRfL9","fields":{"SELECTION":"Direction.CLOCKWISE"}}}},"next":{"block":{"type":"variables_set_car","id":"j)lq`!^P1o1ceoYe%G+3","extraState":{"optionLevel":0},"fields":{"VAR":{"id":"2acT10/A`Fex(wwy}W+6"}},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":";r3:9X$bb+H#~5|hn9WZ","fields":{"VAR":{"id":"O@jZR`(J23rp@~@jkkhi","name":"selector","type":"Motor"}}}},"VAR2":{"shadow":{"type":"variables_get_motor_device","id":"+gb`]viYPo?~v2BH+knK","fields":{"VAR":{"id":"5HU%28@!jf]8vmM^,^47","name":"motor_A","type":"Motor"}}}}},"next":{"block":{"type":"variables_setup_any","id":"Yh~MhU5ZM}XL:XXj4+g5","fields":{"VAR":{"id":"W4{}E70qqo],iAP)%S`8"}},"inputs":{"VALUE0":{"shadow":{"type":"blockMathNumber","id":"+kO!iP$1yIqKGU(CnL{E","fields":{"NUM":0}}}}}}}}}}}}}}}}}}},{"type":"blockGlobalStart","id":"3tJe|AWl0baN(wH9a$@.","x":126,"y":2,"deletable":false,"next":{"block":{"type":"blockFlowWhile","id":"_$=${yv^gG))DL79y!z+","fields":{"MODE":"WHILE"},"inputs":{"BOOL":{"shadow":{"type":"blockLogicTrue","id":"8{=*GuZ6HlN=0T_keN.a"}},"DO":{"block":{"type":"blockIfElse","id":"V8WrKc;ORS7ecNWyL@wt","extraState":{"optionLevel":4},"inputs":{"IF0":{"shadow":{"type":"blockLogicTrue","id":"LwbBhvf)PW`Ayc:A8FT2"},"block":{"type":"blockLogicCompare","id":"C8;vWv0=9$A4grn4wq}=","fields":{"OP1":"EQ"},"inputs":{"A":{"shadow":{"type":"blockMathNumber","id":"dg-EF^:J3NS#5*#`0j_=","fields":{"NUM":3}},"block":{"type":"blockJoystickValue","id":"Isz6$HZa~ohwo:cxrlCO","fields":{"JOYSTICK":"XBOX_DPAD"},"inputs":{"VAR":{"shadow":{"type":"variables_get_gamepad","id":"U~F|2IV}#BQUk{qg_L*U","fields":{"VAR":{"id":"g,=jtze%JV!E9QQ9y;9P","name":"controller","type":"XboxController"}}}}}}},"B":{"shadow":{"type":"blockMathNumber","id":"F-jC:0vj5Mjb$kNilF2*","fields":{"NUM":1}}}}}},"DO0":{"block":{"type":"blockLightOnColor","id":"=1zIX{aRl/+J=}/_unw*","extraState":{"optionLevel":1},"fields":{"METHOD":"LIGHT_ON"},"inputs":{"VAR":{"shadow":{"type":"variables_get_color_light_device","id":"BF=|w.%{X/H3(:Ozr4r]","fields":{"VAR":{"id":"|2j?OJJ@}Lr;v!]9Dd`N","name":"technic hub","type":"TechnicHub"}}}},"COLOR":{"shadow":{"type":"variables_get_color","id":"-34D=bz+SM6@@/~VyqDo","fields":{"COLOUR":"#ff0000","VAR":{"id":"XI~cb)C9o]o+1*]UC=)g","name":"red","type":"ColorDef"}}}}},"next":{"block":{"type":"blockVariableSetValue","id":"_H@B?M$N$9D.?{@LbJ;`","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"bEGXE;((ION7mHpf}+yp","fields":{"VAR":{"id":"W4{}E70qqo],iAP)%S`8","name":"position","type":"Any"}}}},"VALUE0":{"shadow":{"type":"blockMathNumber","id":";:$(Zu2h{s!9+CiD)[C+","fields":{"NUM":-135}}}},"next":{"block":{"type":"blockFunctionCallerStatement","id":"D6.AGyJ(@J|`.wpO?Z-[","extraState":{"optionLevel":0},"fields":{"ICON":"TASK","VAR":{"id":"R1o^{YWOv9GQbBBDu|bQ"}}}}}}}},"IF1":{"shadow":{"type":"blockLogicTrue","id":"zdXdGa4ZcO?/Q==OYX6Z"},"block":{"type":"blockLogicCompare","id":"*,{Q8RB?5;O,bA{3Y0yR","fields":{"OP1":"EQ"},"inputs":{"A":{"shadow":{"type":"blockMathNumber","id":"L8b.:gdy~r0/n_lF9-]]","fields":{"NUM":3}},"block":{"type":"blockJoystickValue","id":"Azpk_RVTOeA.*b3W`6WJ","fields":{"JOYSTICK":"XBOX_DPAD"},"inputs":{"VAR":{"shadow":{"type":"variables_get_gamepad","id":"isbx5|EE[L+QOEF/gJbM","fields":{"VAR":{"id":"g,=jtze%JV!E9QQ9y;9P","name":"controller","type":"XboxController"}}}}}}},"B":{"shadow":{"type":"blockMathNumber","id":"{X#w-bY)gKv@P^mQ8P]/","fields":{"NUM":3}}}}}},"DO1":{"block":{"type":"blockLightOnColor","id":",4_U+pci,6JwXK9YICbY","extraState":{"optionLevel":1},"fields":{"METHOD":"LIGHT_ON"},"inputs":{"VAR":{"shadow":{"type":"variables_get_color_light_device","id":"d8LqZxWE;c7OEeb;_MDB","fields":{"VAR":{"id":"|2j?OJJ@}Lr;v!]9Dd`N","name":"technic hub","type":"TechnicHub"}}}},"COLOR":{"shadow":{"type":"variables_get_color","id":"yLnkZ@rtJn.,l_)SX$2S","fields":{"COLOUR":"#ffff00","VAR":{"id":"NQJ2HdZjza*1VGSh$H`.","name":"yellow","type":"ColorDef"}}}}},"next":{"block":{"type":"blockVariableSetValue","id":"s|/jqrH6K21}kj}Gtvc%","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"A(Xmp`oXB.dGt^@A=fv,","fields":{"VAR":{"id":"W4{}E70qqo],iAP)%S`8","name":"position","type":"Any"}}}},"VALUE0":{"shadow":{"type":"blockMathNumber","id":"+Am3x*NZ9K!h]gz4VIL@","fields":{"NUM":-45}}}},"next":{"block":{"type":"blockFunctionCallerStatement","id":"V}h-B{/9LxMt~34e^*cH","extraState":{"optionLevel":0},"fields":{"ICON":"TASK","VAR":{"id":"R1o^{YWOv9GQbBBDu|bQ"}}}}}}}},"IF2":{"shadow":{"type":"blockLogicTrue","id":"M[|],iLVEeM)J/+WPG$s"},"block":{"type":"blockLogicCompare","id":"(DbWx{r]6~S,83m/suK+","fields":{"OP1":"EQ"},"inputs":{"A":{"shadow":{"type":"blockMathNumber","id":"0}.!PV51E@WE))t6f#pQ","fields":{"NUM":3}},"block":{"type":"blockJoystickValue","id":"wA?FHOKMqkt/$FEqDk:|","fields":{"JOYSTICK":"XBOX_DPAD"},"inputs":{"VAR":{"shadow":{"type":"variables_get_gamepad","id":"_9ZCH/lWozHGVfx4lU+l","fields":{"VAR":{"id":"g,=jtze%JV!E9QQ9y;9P","name":"controller","type":"XboxController"}}}}}}},"B":{"shadow":{"type":"blockMathNumber","id":"iJ#q%}HryXDS9GDW7(H.","fields":{"NUM":5}}}}}},"DO2":{"block":{"type":"blockLightOnColor","id":"Y]u.ny2|(ex7exMkH3Gm","extraState":{"optionLevel":1},"fields":{"METHOD":"LIGHT_ON"},"inputs":{"VAR":{"shadow":{"type":"variables_get_color_light_device","id":"Ts1MT^M+,@t=WdxD0KDY","fields":{"VAR":{"id":"|2j?OJJ@}Lr;v!]9Dd`N","name":"technic hub","type":"TechnicHub"}}}},"COLOR":{"shadow":{"type":"variables_get_color","id":"9AXIoyL)YSvnPcUex)eR","fields":{"COLOUR":"#00ff00","VAR":{"id":"h(o`Ox=QR;hOf_1tNPi1","name":"green","type":"ColorDef"}}}}},"next":{"block":{"type":"blockVariableSetValue","id":"@O_Cv[MT[X;.)K,-l]G0","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"40aGMQo|1E8ZugVX$KlC","fields":{"VAR":{"id":"W4{}E70qqo],iAP)%S`8","name":"position","type":"Any"}}}},"VALUE0":{"shadow":{"type":"blockMathNumber","id":"GtD[1t/#:I|uom(*$M:[","fields":{"NUM":45}}}},"next":{"block":{"type":"blockFunctionCallerStatement","id":"*Jh=xnZl.TDn9K32w?dN","extraState":{"optionLevel":0},"fields":{"ICON":"TASK","VAR":{"id":"R1o^{YWOv9GQbBBDu|bQ"}}}}}}}},"IF3":{"shadow":{"type":"blockLogicTrue","id":"V-:A;oIQXQp~Dv/03u)`"},"block":{"type":"blockLogicCompare","id":"c*$x^5nJ0+?qxNPOnc5|","fields":{"OP1":"EQ"},"inputs":{"A":{"shadow":{"type":"blockMathNumber","id":"bUI9wrM_99fi@Qqoi7@:","fields":{"NUM":3}},"block":{"type":"blockJoystickValue","id":"bxz^Ty(lu5a|j(jEtIOn","fields":{"JOYSTICK":"XBOX_DPAD"},"inputs":{"VAR":{"shadow":{"type":"variables_get_gamepad","id":"QpI|`=a[oz8+`aM_^mhu","fields":{"VAR":{"id":"g,=jtze%JV!E9QQ9y;9P","name":"controller","type":"XboxController"}}}}}}},"B":{"shadow":{"type":"blockMathNumber","id":"Js##i^v@Dv|-^`:}o`,k","fields":{"NUM":7}}}}}},"DO3":{"block":{"type":"blockLightOnColor","id":"L2Fe6{N(.rhwO,0RI`M`","extraState":{"optionLevel":1},"fields":{"METHOD":"LIGHT_ON"},"inputs":{"VAR":{"shadow":{"type":"variables_get_color_light_device","id":"1|wG%/2/l:r.()X9|S)[","fields":{"VAR":{"id":"|2j?OJJ@}Lr;v!]9Dd`N","name":"technic hub","type":"TechnicHub"}}}},"COLOR":{"shadow":{"type":"variables_get_color","id":"Clm(Q$0x*H3~{Cc+Hmg+","fields":{"COLOUR":"#0000ff","VAR":{"id":"dSqC`AhVN0gVeus6,,%F","name":"blue","type":"ColorDef"}}}}},"next":{"block":{"type":"blockVariableSetValue","id":"mo^%_F]?P?*Er_:YX_Kj","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"v*h7f*;r^,S6f;UgqI0f","fields":{"VAR":{"id":"W4{}E70qqo],iAP)%S`8","name":"position","type":"Any"}}}},"VALUE0":{"shadow":{"type":"blockMathNumber","id":"FJXYW1BJSfYlL,=vkuOM","fields":{"NUM":135}}}},"next":{"block":{"type":"blockFunctionCallerStatement","id":"9ZqtIwM/C2qxbk-(*0j=","extraState":{"optionLevel":0},"fields":{"ICON":"TASK","VAR":{"id":"R1o^{YWOv9GQbBBDu|bQ"}}}}}}}},"ELSE":{"block":{"type":"blockMotorDuty","id":"c?6OUPdkYcpSWT43#bo(","inputs":{"VAR":{"shadow":{"type":"variables_get_simple_motor_device","id":"MFW#_Z.cotxlJ`u+_f?L","fields":{"VAR":{"id":"5HU%28@!jf]8vmM^,^47","name":"motor_A","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_percent","id":"TOB^KaQp;5xG_3#1vlM.","fields":{"VALUE0":50}},"block":{"type":"blockJoystickValue","id":"!,2e]h6o-2!!!cts(S*^","fields":{"JOYSTICK":"XBOX_LJ_Y"},"inputs":{"VAR":{"shadow":{"type":"variables_get_gamepad","id":"rhCY]]_B**c!{$|A4c88","fields":{"VAR":{"id":"g,=jtze%JV!E9QQ9y;9P","name":"controller","type":"XboxController"}}}}}}}},"next":{"block":{"type":"blockMotorDuty","id":"kzLV]Bi7FW7N~T0(X`6E","inputs":{"VAR":{"shadow":{"type":"variables_get_simple_motor_device","id":"};s4z?CP5bRE7]D79orN","fields":{"VAR":{"id":"#]whAf15rbW_He}x+Elh","name":"motor_B","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_percent","id":"/*?7aGt,OD9eNT]v#9s[","fields":{"VALUE0":50}},"block":{"type":"blockJoystickValue","id":"x]KhlJJb=5y;kiK{)e0i","fields":{"JOYSTICK":"XBOX_RJ_Y"},"inputs":{"VAR":{"shadow":{"type":"variables_get_gamepad","id":"i:IIyXl+0[6HCQk#X?2o","fields":{"VAR":{"id":"g,=jtze%JV!E9QQ9y;9P","name":"controller","type":"XboxController"}}}}}}}}}}}}}}}}}}},{"type":"variables_setup_function","id":".,Hj}.rpFHN7,n!a-5(A","x":-661,"y":465,"extraState":{"optionLevel":0},"fields":{"ICON":"TASK","VAR":{"id":"R1o^{YWOv9GQbBBDu|bQ"}},"inputs":{"STACK":{"block":{"type":"blockMotorRun","id":"oFqryMtk.4?.HzEn8Z2w","extraState":{"optionLevel":2},"fields":{"METHOD":"MOTOR_RUN_TO"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"Cob@ul[mSfD{Kt#bz:!?","fields":{"VAR":{"id":"O@jZR`(J23rp@~@jkkhi","name":"selector","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_angularVelocity","id":"EW[?QWRt/nky~o$*?yNH","fields":{"VALUE0":500}}},"ANGLE":{"shadow":{"type":"unit_angle","id":"_U_XBVX.9T47X!yxzg{W","fields":{"VALUE0":360}},"block":{"type":"blockVariableGetValue","id":"o_s`@[R+SIWY5^/-s]1/","inputs":{"VAR":{"shadow":{"type":"variables_get_any","id":"GTW?kS^U/{yd+9a59A%v","fields":{"VAR":{"id":"W4{}E70qqo],iAP)%S`8","name":"position","type":"Any"}}}}}}},"THEN":{"shadow":{"type":"parameters_stop_4","id":"bqZMmq,*/0z_@68a%ogX","fields":{"VALUE":"Stop.HOLD"}}}}}}}}]},"variables":[{"name":"red","id":"XI~cb)C9o]o+1*]UC=)g","type":"ColorDef"},{"name":"orange","id":"^0lt:-@G`gz1#$5c.U*T","type":"ColorDef"},{"name":"yellow","id":"NQJ2HdZjza*1VGSh$H`.","type":"ColorDef"},{"name":"green","id":"h(o`Ox=QR;hOf_1tNPi1","type":"ColorDef"},{"name":"cyan","id":"Zo9|k|QBJqfpW@80DIM3","type":"ColorDef"},{"name":"blue","id":"dSqC`AhVN0gVeus6,,%F","type":"ColorDef"},{"name":"violet","id":"`k|:J%RB9?J`qB6xekDB","type":"ColorDef"},{"name":"magenta","id":"S6w@A:e%D-7XRbfe!zM#","type":"ColorDef"},{"name":"white","id":"6}T:HOezi._pA@gb}crh","type":"ColorDef"},{"name":"none","id":"n0dq0wA?n9RpVgvhq6/D","type":"ColorDef"},{"name":"technic hub","id":"|2j?OJJ@}Lr;v!]9Dd`N","type":"TechnicHub"},{"name":"car","id":"2acT10/A`Fex(wwy}W+6","type":"Car"},{"name":"controller","id":"g,=jtze%JV!E9QQ9y;9P","type":"XboxController"},{"name":"selector","id":"O@jZR`(J23rp@~@jkkhi","type":"Motor"},{"name":"motor_A","id":"5HU%28@!jf]8vmM^,^47","type":"Motor"},{"name":"motor_B","id":"#]whAf15rbW_He}x+Elh","type":"Motor"},{"name":"position","id":"W4{}E70qqo],iAP)%S`8","type":"Any"},{"name":"selector_to_position","id":"R1o^{YWOv9GQbBBDu|bQ","type":"Function"}]}
from pybricks.hubs import TechnicHub
from pybricks.iodevices import XboxController
from pybricks.parameters import Color, Direction, Port, Stop
from pybricks.pupdevices import Motor
from pybricks.robotics import Car

# Set up all devices.
technic_hub = TechnicHub()
motor_A = Motor(Port.A, Direction.CLOCKWISE)
motor_B = Motor(Port.B, Direction.CLOCKWISE)
selector = Motor(Port.C, Direction.CLOCKWISE)
car = Car(selector, motor_A)
controller = XboxController()

# Initialize variables.
position = 0

def selector_to_position():
    selector.run_target(500, position)


# The main program starts here.
while True:
    if controller.dpad() == 1:
        technic_hub.light.on(Color.RED)
        position = -135
        selector_to_position()
    elif controller.dpad() == 3:
        technic_hub.light.on(Color.YELLOW)
        position = -45
        selector_to_position()
    elif controller.dpad() == 5:
        technic_hub.light.on(Color.GREEN)
        position = 45
        selector_to_position()
    elif controller.dpad() == 7:
        technic_hub.light.on(Color.BLUE)
        position = 135
        selector_to_position()
    else:
        motor_A.dc(controller.joystick_left()[1])
        motor_B.dc(controller.joystick_right()[1])

 

Edited by le60head

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...