The VEX Visual Studio Code Extension has replaced VEXcode Pro V5, which is now end-of-life.
VEXcode Blocks and VEXcode Text remain actively developed and supported for all VEX platforms.
സാമ്പിൾ: ഒരു റോബോട്ടിന് നേർരേഖയിൽ സഞ്ചരിക്കാനുള്ള ഒരു സാമ്പിൾ പ്രോഗ്രാം.
ഇനിപ്പറയുന്ന ഫംഗ്ഷൻ റോബോട്ടിനെtotalEncഎൻകോഡറിനായി മുന്നോട്ട് പ്രവർത്തിപ്പിക്കാൻ അനുവദിക്കും. ഇത് V5 Clawbot കോൺഫിഗറേഷൻ ഉപയോഗിക്കുന്നു.
ഈspinToPositionഫംഗ്ഷൻ ചലനം പൂർത്തിയാകുന്നതുവരെ തിരികെ വരില്ല. ഇതിനെ "സിൻക്രൊണൈസ്ഡ്" ആക്ഷൻ എന്ന് വിളിക്കുന്നു - അവസാന പാരാമീറ്റർtrueനിർണ്ണയിക്കുന്നു.
ഉപയോക്തൃ-നിർവചിത ഫംഗ്ഷൻ ഉപയോഗിക്കാതെ:
int main() {
vexcodeInit();
LeftMotor.resetPosition();
LeftMotor.setVelocity(100.0, ശതമാനം);
LeftMotor.spinToPosition(500.0, ഡിഗ്രി, ശരി);
Brain.Screen.printAt(5,30, "സെക്കൻഡ് rev deg" );
Brain.Screen.printAt(5,60, "%.2f: %8.2f %8.2f",
Brain.Timer.value(),
LeftMotor.position(rev),
LeftMotor.position(deg));
wait(1000, msec);
LeftMotor.resetPosition();
LeftMotor.setVelocity(-100.0, ശതമാനം);
LeftMotor.spinToPosition(-1000.0, c, ശരി);
Brain.Screen.printAt(5,100, "secs rev deg" );
Brain.Screen.printAt(5,130, "%%.2f: %8.2f %8.2f",
Brain.Timer.value(),
LeftMotor.position(rev),
LeftMotor.position(deg));
wait(1000, msec);
}
സാമ്പിൾ ഇനിപ്പറയുന്ന ഫലം നൽകിയേക്കാം:
സെക്കൻഡ് അസംസ്കൃത റെവ ഡിഗ്രി 2.06 5445 3.12 1089
നിങ്ങളുടെ പരിശോധന ദശാംശ സ്ഥാനങ്ങളിൽ വളരെ ചെറിയ മാർജിനിൽ വ്യത്യാസപ്പെടുമെന്ന് ശ്രദ്ധിക്കുക.
ഉപയോക്താവ് നിർവചിച്ച ഫംഗ്ഷൻ ഉപയോഗിച്ച്:
പുനരുപയോഗിക്കാവുന്ന ഒരൊറ്റ "ഫംഗ്ഷൻ" കോളിലേക്ക് ഒരു കൂട്ടം പ്രവർത്തനങ്ങൾ എങ്ങനെ പിടിച്ചെടുക്കാമെന്ന് ഇനിപ്പറയുന്ന സാമ്പിൾ കാണിക്കുന്നു.
void reportMotionValues() {
Brain.Screen.printAt(5, 60, "%.2f: %8.2f %8.2f",
Brain.Timer.value(),
LeftMotor.position(rev),
LeftMotor.position(deg));
}
int main() {
vexcodeInit();
LeftMotor.resetPosition();
LeftMotor.setVelocity(50.0, ശതമാനം);
LeftMotor.spinToPosition(500.0, ഡിഗ്രി, ശരി);
reportMotionValues();
LeftMotor.resetPosition();
LeftMotor.setVelocity(-50.0, ശതമാനം);
LeftMotor.spinToPosition(-500.0, ഡിഗ്രി, ശരി);
reportMotionValues();
}
കോളർ ഫംഗ്ഷൻ main() ൽ നിന്നുള്ള ലോജിക് ഫ്ലോയുടെ ക്രമം ഇവിടെ കാണിക്കുന്നു: