int main(void) { pinIO(); serialSetupUSB(); timerSetup(); motorSetup(); encSetup(); //infinete loop in which we count while(1) { //currentVelocity = velocityGet(); moveForward(16); delay(10); moveBackward(16); } //remain here forever, never end the main function. return 0; //we should never really return }
int main(void) { pinIO(); serialSetupUSB(); setupA2D(); encSetup(); //infinete loop in which we count while(1) { } //remain here forever, never end the main function. return 0; //we should never really return }
int main(){ uint32_t t1; uint32_t t2; int deltaT=0; int T=1; Setup(); encSetup(); long x_ [SIM_TIME]; int i = 0; V2pwm(0.0); t1=millis(); deltaT=millis()-t1; while(deltaT<2000){ deltaT=millis()-t1; } t1=millis(); t2=millis(); V2pwm(6.0); while(millis()-t2 < SIM_TIME){ LeEncoder(); deltaT=millis()-t1; if(deltaT>=T){ t1=millis(); x_[i] = ReturnCounter(); i++; } } V2pwm(0.0); for (i=0; i<SIM_TIME; i++){ printf("%ld\n", x_[i]); } return 0; }
int main(void) { pinIO(); serialSetupUSB(); serialSetupP2P(); timerSetup(); //pwmSetup(); setupA2D(); motorSetup(); encSetup(); int motor1; //int motor1speed = 200; int motor2speed = 200; char targetVelocity1 = 0; char currentVelocity; float pop; char error = 0; //infinete loop in which we count while(1) { //currentVelocity = velocityGet(); motor1 = motorSet(39); motor1 = 200; //targetVelocity1 = 30; //error = targetVelocity1 - currentVelocity; //int test /* if (currentVelocity > targetVelocity1) { if(motor1speed > 0) { motor1speed -=2; } else { motor1speed = 0; } } else if (currentVelocity < targetVelocity1) { if(motor1speed < 798) { motor1speed +=2; } else { motor1speed = 798; } //motor1speed = 798*(float)(1-(float)(currentVelocity / targetVelocity1)); }*/ motor1Forward(motor1); motor2Forward(motor2speed); } //remain here forever, never end the main function. return 0; //we should never really return }