代码拉取完成,页面将自动刷新
{"wrkspace":"<xml xmlns=\"http://www.w3.org/1999/xhtml\"><variables><variable type=\"\" id=\"_2.^beQjx|FGt38A,8(E\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">my variable</variable></variables><block type=\"iq_events_when_started\" id=\".NsXwU_L.OuU1l7Sho$F\" x=\"-130\" y=\"-170\"><next><block type=\"iq_control_forever\" id=\"_/p`z(GtMy7}Y2=.8)gw\"><statement name=\"SUBSTACK\"><block type=\"iq_control_if_then_else\" id=\"-D8|WBRpYN+.N:*YRdLp\"><value name=\"CONDITION\"><block type=\"iq_operator_less_than\" id=\"TK1vJhAQ+n{fZ-]6S#!*\"><value name=\"OPERAND1\"><shadow type=\"math_number\" id=\"?i0VXz,~czohZrSyp0eb\"><field name=\"NUM\"></field></shadow><block type=\"iq_sensing_distance_from\" id=\"W%-Xy/(FbCJ;hX}C}Cb~\"><field name=\"SONAR\">Distance12</field><field name=\"UNITS\">mm</field></block></value><value name=\"OPERAND2\"><shadow type=\"math_number\" id=\"{`xkE2E;(dh#((SB)zp2\"><field name=\"NUM\">700</field></shadow></value></block></value><statement name=\"SUBSTACK\"><block type=\"iq_sounds_play_sound\" id=\"/2To[QqYYUov;r[9a/#{\"><field name=\"SOUND\">siren2</field><next><block type=\"iq_control_wait\" id=\"X!wU5=D?4E2TdW@8g]A[\"><value name=\"DURATION\"><shadow type=\"math_positive_number\" id=\"r:B8y~8N){8)*Y%jNOr{\"><field name=\"NUM\">0.1</field></shadow></value><next><block type=\"iq_sounds_play_sound\" id=\"y=5/al76Jdpmjf(,+fX4\"><field name=\"SOUND\">siren2</field><next><block type=\"iq_control_wait\" id=\"{,:Km6b-D67+s.BX|3U1\"><value name=\"DURATION\"><shadow type=\"math_positive_number\" id=\"=7`mjAHZTNW$1;,[%h-n\"><field name=\"NUM\">0.1</field></shadow></value><next><block type=\"iq_sounds_play_sound\" id=\"WlZ{ni:80,sG=?+MM5yV\"><field name=\"SOUND\">siren2</field></block></next></block></next></block></next></block></next></block></statement><statement name=\"SUBSTACK2\"><block type=\"iq_looks_set_touchled_color\" id=\"ZfYPre@rrcDUsOSz[kl)\"><field name=\"TOUCHLED\">TouchLED4</field><value name=\"COLOR\"><shadow type=\"iq_looks_colorlist\" id=\"$ja3XGP95JgsHs3(qY/Z\"><field name=\"COLOR\">green</field></shadow></value></block></statement><next><block type=\"iq_control_if_then\" id=\"6-E*zvYczUrTeEe7y!Fa\"><value name=\"CONDITION\"><block type=\"iq_sensing_pressing_bumper\" id=\"4P{WD@{Oe2%qB7[-.A-]\"><field name=\"BUMPER\">Bumper3</field></block></value><statement name=\"SUBSTACK\"><block type=\"iq_motion_set_motor_stopping\" id=\"k[.xZMCKG75(LQjBy4Xa\"><field name=\"MOTOR\">Motor2</field><field name=\"MODE\">brake</field><next><block type=\"iq_motion_set_motor_stopping\" id=\"Rjwkz5+A@n%u5uHGJ0sI\"><field name=\"MOTOR\">Motor8</field><field name=\"MODE\">brake</field></block></next></block></statement></block></next></block></statement></block></next></block><block type=\"iq_events_when_started\" id=\"#i4SeAyYRMV)%~{2[R8{\" x=\"390\" y=\"-150\"><next><block type=\"iq_control_forever\" id=\"F12]d3=b,5zd+a[?6Hq9\"><statement name=\"SUBSTACK\"><block type=\"iq_control_if_then\" id=\"KPC5[.;+dT,:0|WX:B,G\"><value name=\"CONDITION\"><block type=\"iq_operator_less_than\" id=\"h!bEw/gtPC]WfR*9NV@A\"><value name=\"OPERAND1\"><shadow type=\"math_number\" id=\"=QF8M!jx$w?mO=x-,%Io\"><field name=\"NUM\"></field></shadow><block type=\"iq_sensing_distance_from\" id=\"zEhmDYW-oNXFQ^z4[QR{\"><field name=\"SONAR\">Distance12</field><field name=\"UNITS\">mm</field></block></value><value name=\"OPERAND2\"><shadow type=\"math_number\" id=\"46%G6`:[y]In11^g;@3R\"><field name=\"NUM\">700</field></shadow></value></block></value><statement name=\"SUBSTACK\"><block type=\"iq_looks_set_touchled_color\" id=\"/;`3sgEr@.x}YiP^T!pV\"><field name=\"TOUCHLED\">TouchLED4</field><value name=\"COLOR\"><shadow type=\"iq_looks_colorlist\" id=\"7MLC86c7^;S88KVpo:d:\"><field name=\"COLOR\">red</field></shadow></value></block></statement></block></statement></block></next></block><block type=\"iq_events_when_started\" id=\"kZvOc0MHu%@q0sqM6;%@\" x=\"-90\" y=\"650\"><next><block type=\"iq_control_forever\" id=\"I~=j8lZD2^.AwQM-$YwP\"><statement name=\"SUBSTACK\"><block type=\"iq_control_if_then\" id=\"hvMysnkFBZWKLYlKaE/{\"><value name=\"CONDITION\"><block type=\"iq_operator_less_than\" id=\"M!4J]100q?WK}XT+a,~~\"><value name=\"OPERAND1\"><shadow type=\"math_number\" id=\"s4d1,A?E$HYO*]8Nn;]V\"><field name=\"NUM\"></field></shadow><block type=\"iq_sensing_distance_from\" id=\"72Tv,myT7[ARc7zfhlW1\"><field name=\"SONAR\">Distance1</field><field name=\"UNITS\">mm</field></block></value><value name=\"OPERAND2\"><shadow type=\"math_number\" id=\"9SN2:Ny{Wso~=h:8{|cE\"><field name=\"NUM\">50</field></shadow></value></block></value><statement name=\"SUBSTACK\"><block type=\"iq_motion_spin\" id=\"KOo4/;wI{(ECRJNT8s+F\"><field name=\"MOTOR\">Motor2</field><field name=\"DIRECTION\">rev</field><next><block type=\"iq_motion_spin\" id=\"uP[mR8cZDhr!cPn`RNDC\"><field name=\"MOTOR\">Motor8</field><field name=\"DIRECTION\">fwd</field><next><block type=\"iq_control_wait\" id=\"m![j#2+vuxX.tQ%n6t.H\"><value name=\"DURATION\"><shadow type=\"math_positive_number\" id=\").wOaJ]4[52lTyJ7pW1%\"><field name=\"NUM\">2</field></shadow></value><next><block type=\"iq_motion_set_motor_stopping\" id=\"[_~eraPgGfbE/7NO5h5:\"><field name=\"MOTOR\">Motor2</field><field name=\"MODE\">brake</field><next><block type=\"iq_motion_set_motor_stopping\" id=\"y$=Zb=qFN,Uj#h+Av+ot\"><field name=\"MOTOR\">Motor8</field><field name=\"MODE\">brake</field><next><block type=\"iq_control_wait\" id=\"6{f.l;lm!HiS5_wFl,SG\"><value name=\"DURATION\"><shadow type=\"math_positive_number\" id=\"V!sa;cqzB_Y(#P:f-Kfo\"><field name=\"NUM\">0.8</field></shadow></value><next><block type=\"iq_motion_spin\" id=\"mMnR*S/7~_%gb?$UGNd+\"><field name=\"MOTOR\">Motor2</field><field name=\"DIRECTION\">fwd</field><next><block type=\"iq_motion_spin\" id=\"f:zd1nvB!tq~dkCGhLWI\"><field name=\"MOTOR\">Motor8</field><field name=\"DIRECTION\">rev</field><next><block type=\"iq_control_wait\" id=\"}6z4SqcSxsUcpKU;g4zD\"><value name=\"DURATION\"><shadow type=\"math_positive_number\" id=\"(GRM_v%`c;86TcG!Xkg6\"><field name=\"NUM\">2</field></shadow></value><next><block type=\"iq_motion_set_motor_stopping\" id=\"Cx@b(G`E1(;n,a({n^x:\"><field name=\"MOTOR\">Motor2</field><field name=\"MODE\">brake</field><next><block type=\"iq_motion_set_motor_stopping\" id=\"|NL|XEV)Y#*m2o]/QC-w\"><field name=\"MOTOR\">Motor8</field><field name=\"MODE\">brake</field></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block></statement></block></next></block></xml>","rconfig":[{"port":[2],"name":"Motor2","customName":false,"deviceType":"Motor","setting":{"reversed":"false","fwd":"正","rev":"反"}},{"port":[1],"name":"Distance1","customName":false,"deviceType":"Distance","setting":{}},{"port":[8],"name":"Motor8","customName":false,"deviceType":"Motor","setting":{"reversed":"false","fwd":"正","rev":"反"}},{"port":[3],"name":"Bumper3","customName":false,"deviceType":"Bumper","setting":{}},{"port":[12],"name":"Distance12","customName":false,"deviceType":"Distance","setting":{}},{"port":[4],"name":"TouchLED4","customName":false,"deviceType":"TouchLED","setting":{}}],"slot":0,"cpp":"// Make sure all required headers are included.\n#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <math.h>\n#include <string.h>\n\n\n#include \"iq_cpp.h\"\n\nusing namespace vex;\n\n// Brain should be defined by default\nbrain Brain;\n\n// Robot configuration code.\nmotor Motor2 = motor(vex::PORT2, false);\nsonar Distance1 = sonar(vex::PORT1);\nmotor Motor8 = motor(vex::PORT8, false);\nbumper Bumper3 = bumper(vex::PORT3);\nsonar Distance12 = sonar(vex::PORT12);\ntouchled TouchLED4 = touchled(vex::PORT4);\n\n//Vision sensor index vars.\nint Vision1_objectIndex = 0;\n\nint Brain_precision;\n\n\n// Generated code.\n\nfloat my_variable;\n\nint whenStarted1() {\n while (true) {\n if (Distance12.distance(vex::distanceUnits::mm) < 700.0) {\n Brain.playSound(vex::soundType::siren2);\n task::sleep(static_cast<uint32_t>(0.1*1000));\n Brain.playSound(vex::soundType::siren2);\n task::sleep(static_cast<uint32_t>(0.1*1000));\n Brain.playSound(vex::soundType::siren2);\n } else {\n TouchLED4.on(vex::colorType::green);\n }\n if (Bumper3.pressing()) {\n Motor2.setStopping(vex::brakeType::brake);\n Motor8.setStopping(vex::brakeType::brake);\n }\n task::sleep(20);\n }\nreturn 0;\n}\n\nint whenStarted2() {\n while (true) {\n if (Distance12.distance(vex::distanceUnits::mm) < 700.0) {\n TouchLED4.on(vex::colorType::red);\n }\n task::sleep(20);\n }\nreturn 0;\n}\n\nint whenStarted3() {\n while (true) {\n if (Distance1.distance(vex::distanceUnits::mm) < 50.0) {\n Motor2.spin(vex::directionType::rev);\n Motor8.spin(vex::directionType::fwd);\n task::sleep(static_cast<uint32_t>(2.0*1000));\n Motor2.setStopping(vex::brakeType::brake);\n Motor8.setStopping(vex::brakeType::brake);\n task::sleep(static_cast<uint32_t>(0.8*1000));\n Motor2.spin(vex::directionType::fwd);\n Motor8.spin(vex::directionType::rev);\n task::sleep(static_cast<uint32_t>(2.0*1000));\n Motor2.setStopping(vex::brakeType::brake);\n Motor8.setStopping(vex::brakeType::brake);\n }\n task::sleep(20);\n }\nreturn 0;\n}\n\n\nint main() {\n\n\n srand(vex::timer::system());\n\n\n\n // pre event registration\n // register event handlers\n\n task::sleep(15);\n // post event registration\n\n // when started blocks...\n vex::task ws1(whenStarted2);\n vex::task ws2(whenStarted3);\n whenStarted1();\n return 0;\n}","cppStatus":"true","platform":"IQ","sdkVersion":"0.4.3","appVersion":"1.0.1-344","fileFormat":"0.1.0","icon":""}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。