# pybricks blocks file:{"blocks":{"languageVersion":0,"blocks":[{"type":"blockGlobalSetup","id":"bjK,wS1MYO7aiYkFSwd{","x":69,"y":39,"deletable":false,"next":{"block":{"type":"variables_set_prime_hub","id":"K{!tJO^8:4q#tG-,J.kn","extraState":{"optionLevel":0},"fields":{"VAR":{"id":"W^z:7I/)7B!)P,+zI5Z!"}},"next":{"block":{"type":"variables_set_motor","id":"1EBnvzxO~lDouQUNsOr6","fields":{"VAR":{"id":"*2Ue{nu1.?GvuLJm*!gR"}},"inputs":{"PORT":{"shadow":{"type":"blockParametersPort","id":"(LO+K^rYEm+M`f4T]L!K","fields":{"NAME":"A"}}},"POSITIVE_DIRECTION":{"shadow":{"type":"blockParametersDirection","id":"=Y0!-h)OkFm{zOQOnikP","fields":{"SELECTION":"Direction.COUNTERCLOCKWISE"}}}},"next":{"block":{"type":"variables_set_motor","id":".b!R;*2W79TD)i+pWuzV","fields":{"VAR":{"id":"p|5_3-Hjl1sZ@x^6U/$="}},"inputs":{"PORT":{"shadow":{"type":"blockParametersPort","id":"AI^h_f2XGeP[)mhX}Px|","fields":{"NAME":"B"}}},"POSITIVE_DIRECTION":{"shadow":{"type":"blockParametersDirection","id":"E)#=?p5N}8qYX|km]mlq","fields":{"SELECTION":"Direction.CLOCKWISE"}}}},"next":{"block":{"type":"variables_set_drive_base","id":"tKu:XI$Qj6@VSf`R}*Sr","fields":{"VAR":{"id":"0{y#~[I*eCvWYeRgZDuM"}},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"|,%rU$ou3UQDfe,X6!e=","fields":{"VAR":{"id":"*2Ue{nu1.?GvuLJm*!gR","name":"left wheel","type":"Motor"}}}},"VAR2":{"shadow":{"type":"variables_get_motor_device","id":":o9.24iO@to,f]zH[NG7","fields":{"VAR":{"id":"p|5_3-Hjl1sZ@x^6U/$=","name":"right wheel","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_distance","id":"q}.ymtj6[B$J%%y+Ch$T","fields":{"VALUE0":65}}},"VALUE1":{"shadow":{"type":"unit_distance","id":"7Zy292wdaTkC47:B}X?T","fields":{"VALUE0":137}}}}}}}}}}}}},{"type":"blockGlobalStart","id":"3tJe|AWl0baN(wH9a$@.","x":420,"y":351,"deletable":false,"next":{"block":{"type":"blockDriveBaseDrive2","id":":+luQ{L5,O,-3g6^L*?t","extraState":{"optionLevel":2},"fields":{"METHOD":"DRIVEBASE_DRIVE_STRAIGHT"},"inputs":{"VAR":{"shadow":{"type":"variables_get_drive_base_device","id":"U49F=dP(G3!vN_^;JorU","fields":{"VAR":{"id":"0{y#~[I*eCvWYeRgZDuM","name":"drive base","type":"DriveBase"}}}},"ARG0":{"shadow":{"type":"unit_distance","id":"P{8$IxLOSWQY+7{|xLEV","fields":{"VALUE0":300}}},"ARG1":{"shadow":{"type":"parameters_stop_4","id":"lRR_P-}H!8IIqx49A`3b","fields":{"VALUE":"Stop.BRAKE"}}}},"next":{"block":{"type":"blockDriveBaseDrive2","id":"J@SBl81Upe}G+(S6@;ip","extraState":{"optionLevel":4},"fields":{"METHOD":"DRIVEBASE_DRIVE_ARC_ANGLE"},"inputs":{"VAR":{"shadow":{"type":"variables_get_drive_base_device","id":"5%_|2L_?Bxqlm0i8V`Ig","fields":{"VAR":{"id":"0{y#~[I*eCvWYeRgZDuM","name":"drive base","type":"DriveBase"}}}},"ARG0":{"shadow":{"type":"unit_distance","id":"kkmNH@f(#YR{aSK6eQXb","fields":{"VALUE0":-100}}},"ARG1":{"shadow":{"type":"unit_angle","id":"^,c3M_p:$X9}s_pszm-Z","fields":{"VALUE0":90}}},"ARG2":{"shadow":{"type":"parameters_stop_4","id":"b0ZqkN(pAA(]heAGA5Pt","fields":{"VALUE":"Stop.BRAKE"}}}},"next":{"block":{"type":"blockDriveBaseDrive2","id":"{*W[o0ai|BQfu3X:zJ|b","extraState":{"optionLevel":4},"fields":{"METHOD":"DRIVEBASE_DRIVE_ARC_ANGLE"},"inputs":{"VAR":{"shadow":{"type":"variables_get_drive_base_device","id":"kTO[`VHhn5{e-r?ac5X4","fields":{"VAR":{"id":"0{y#~[I*eCvWYeRgZDuM","name":"drive base","type":"DriveBase"}}}},"ARG0":{"shadow":{"type":"unit_distance","id":"FU3wU)-fRrlDeuhAXP4@","fields":{"VALUE0":100}}},"ARG1":{"shadow":{"type":"unit_angle","id":"Gd@(%WcLn=v*8/Id;b.*","fields":{"VALUE0":90}}},"ARG2":{"shadow":{"type":"parameters_stop_4","id":"4=-:D!2v47LH2`[wX+`u","fields":{"VALUE":"Stop.BRAKE"}}}}}}}}}}},{"type":"blockMotorRun","id":"^cD?waeyWUaC[x@x-;:V","x":337,"y":816,"enabled":false,"extraState":{"optionLevel":1},"fields":{"METHOD":"MOTOR_RUN_FOR"},"inputs":{"VAR":{"shadow":{"type":"variables_get_motor_device","id":"]sfqqYK/nG@RR[1p}.1Y","fields":{"VAR":{"id":"p|5_3-Hjl1sZ@x^6U/$=","name":"right wheel","type":"Motor"}}}},"VALUE0":{"shadow":{"type":"unit_angularVelocity","id":"G%(v4[yW0HyQfj3y)rh,","fields":{"VALUE0":500}}},"ANGLE":{"shadow":{"type":"unit_angle","id":"d=m/a/XsHwuH`8=AGi]e","fields":{"VALUE0":360}}},"THEN":{"shadow":{"type":"parameters_stop_4","id":"S;6i/T:sy0~Q}uMWIx9m","fields":{"VALUE":"Stop.HOLD"}}}}}]},"variables":[{"name":"red","id":"R!(2unAYx(hn@gG@JT7Q","type":"ColorDef"},{"name":"orange","id":"@667*o*jrq!Pub3A8IL?","type":"ColorDef"},{"name":"yellow","id":"Z)!}Gx5h.ozQ%M7Bulex","type":"ColorDef"},{"name":"green","id":"$35RDqc9~7my*iaBIoDw","type":"ColorDef"},{"name":"cyan","id":"XE_F.Ek3V;D4JTjdI3y7","type":"ColorDef"},{"name":"blue","id":"505)$#=/?SB[Eu.Ao[gP","type":"ColorDef"},{"name":"violet","id":"pb+oJZT{An#8!;P5+wkw","type":"ColorDef"},{"name":"magenta","id":"Y_j?qbyP2`5M)W1FV%!|","type":"ColorDef"},{"name":"white","id":"*PKOuDLx#x8iu4Z9o]1A","type":"ColorDef"},{"name":"none","id":"hr#)RxbzpkLYCH?bMX%,","type":"ColorDef"},{"name":"prime hub","id":"W^z:7I/)7B!)P,+zI5Z!","type":"PrimeHub"},{"name":"drive base","id":"0{y#~[I*eCvWYeRgZDuM","type":"DriveBase"},{"name":"left wheel","id":"*2Ue{nu1.?GvuLJm*!gR","type":"Motor"},{"name":"right wheel","id":"p|5_3-Hjl1sZ@x^6U/$=","type":"Motor"},{"name":"motor","id":"gclW.}2kg{ZZVgG`{MQz","type":"Motor"}],"info":{"type":"pybricks","version":"1.3.2"}}
from pybricks.hubs import PrimeHub
from pybricks.parameters import Direction, Port, Stop
from pybricks.pupdevices import Motor
from pybricks.robotics import DriveBase

# Set up all devices.
prime_hub = PrimeHub()
left_wheel = Motor(Port.A, Direction.COUNTERCLOCKWISE)
right_wheel = Motor(Port.B, Direction.CLOCKWISE)
drive_base = DriveBase(left_wheel, right_wheel, 65, 137)


# The main program starts here.
drive_base.straight(300, then=Stop.BRAKE)
drive_base.arc(-100, angle=90, then=Stop.BRAKE)
drive_base.arc(100, angle=90, then=Stop.BRAKE)
