Hi there,
why is the spin command not working?
Pls help me.
thx
/*----------------------------------------------------------------------------*/
/* */
/* Module: main.cpp */
/* Author: Vex */
/* Created: 11/18/2024, 3:24:03 PM */
/* Description: V5 project */
/* */
/*----------------------------------------------------------------------------*/
#include "vex.h"
using namespace vex;
// A global instance of competition
competition Competition;
// define your global instances of motors and other devices here
brain Brain;
//drivetrain
controller Controller1 = controller(primary);
motor linkseins = motor(PORT1, ratio6_1, false);
motor linkszwei = motor(PORT2, ratio6_1, false);
motor rechtszwei = motor(PORT8, ratio6_1, true);
motor rechtseins = motor(PORT9, ratio6_1, true);
void axisthreechanged() {
linkseins.spin(forward, Controller1.Axis1.value() *0,5);
linkszwei.spin(forward, Controller1.Axis1.value() *0,5);
rechtseins.spin(reverse, Controller1.Axis1.value() *0,5);
rechtszwei.spin(reverse, Controller1.Axis1.value() *0,5);
}
void axisonechanged() {
linkseins.spin(forward, Controller1.Axis3.value() *0,5);
linkszwei.spin(forward, Controller1.Axis3.value() *0,5);
rechtseins.spin(forward, Controller1.Axis3.value() *0,5);
rechtszwei.spin(forward, Controller1.Axis3.value() *0,5);
}
void pre_auton(void) {
// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, ...
}
/*---------------------------------------------------------------------------*/
/* */
/* Autonomous Task */
/* */
/* This task is used to control your robot during the autonomous phase of */
/* a VEX Competition. */
/* */
/* You must modify the code to add your own robot specific commands here. */
/*---------------------------------------------------------------------------*/
void autonomous(void) {
// ..........................................................................
// Insert autonomous user code here.
// ..........................................................................
}
/*---------------------------------------------------------------------------*/
/* */
/* User Control Task */
/* */
/* This task is used to control your robot during the user control phase of */
/* a VEX Competition. */
/* */
/* You must modify the code to add your own robot specific commands here. */
/*---------------------------------------------------------------------------*/
void usercontrol(void) {
// User control code here, inside the loop
while (1) {
// This is the main execution loop for the user control program.
// Each time through the loop your program should update motor + servo
// values based on feedback from the joysticks.
// ........................................................................
// Insert user code here. This is where you use the joystick values to
// update your motors, etc.
// ........................................................................
wait(20, msec); // Sleep the task for a short amount of time to
// prevent wasted resources.
}
}
//
// Main will set up the competition functions and callbacks.
//
int main() {
// Set up callbacks for autonomous and driver control periods.
Competition.autonomous(autonomous);
Competition.drivercontrol(usercontrol);
Controller1.Axis3.changed(axisthreechanged);
Controller1.Axis1.changed(axisonechanged);
// Run the pre-autonomous function.
pre_auton();
// Prevent main from exiting with an infinite loop.
while (true) {
wait(100, msec);
}
}
edit: code tags added by mods, please remember to use them.