I just installed the easyC 2.9 trial, downloaded the master code 8 to my vex and recompile my 1.1 project with 2.0 and transfered to my vex, now when i push a button on the channel 5 or 6 its going to fast, with 1.1, like if i where using ch5 to change the pwm of a servo, with every push, it moves the pwm in increments of 5, it take like 20~30 seconds to go from 0 to 255, now on the master code 8 and easyc 2 it only takes one push from the ch5 to go from 0 to 255, i tracked the servo pwm and it goes to fast, is this normal? do i need to put some timers to slow down?
please advise
Yes your best bet would be a timer.
StartTimer(1); //Start Timer 1 (needs to be before while loop)
motorspeed = 127 // set motor speed to neutral
while(1) { //loop forever
rx5=GetRXInput (1,5) //Get Joystick button data
//check if Channel 5 Top button is pressed
//Check to see if 1/10 of a second has gone by, higher the number the slower the ramp up
//Linit the motor speed to a max of 255
if (rx5 == 255 && GetTimer(1) > 100 && motorspeed < 255) {
motorspeed++; // Add one to the motor speed
ResetTimer(1); //Reset the timer to 0
}
//Same as above just reversed
else if (rx5 == 0 && GetTimer(1) > 100 && motorspeed > 0) {
motorspeed–;
ResetTimer(1);
}
if (rx5 == 127){ //if you release the button
motorspeed == 127; //set motorspeed to 127
}
SetMotor(1,motorspeed); //Set Motor 1 to the value of motorspeed
}