my question was :
1. Does it officially needs an encoder?
2. What was the flag functioned to base on the code below...
- CODE: SELECT_ALL_CODE
while(1)
{
// This is an infinity loop after SW3 on IFC-MB00 is pressed.
// The two motors will running independently.
// The speeds will increase and decrease gradually and then direction will be changed.
// This program will running repeatedly until the reset button is pressed.
temp1+=1; // increase temp1
if(temp1>10000) // the value of temp1 here will determine the
{ // acceleration of the motors, the bigger the value here,
// the slower the speed of the increment or decrement
temp1=0; // clear temp1
if(speed1>=255)flag1=1; // set flag 1 to 1 when maximum speed 1 is reached.
else if(speed1<=0)
{
flag1=0; // set [color=#800040]flag[/color] 1 to 0 when minimum speed 1 is reached.
dir1^=1; // change direction of motor 1 for
if(dir1==0)bh_1_ccw(add_bh1); // every speed 1 is equal to 0.
else bh_1_cw(add_bh1);
}
if(flag1==0)speed1++; // increase speed 1 by one if flag 1 is 0.
else speed1--; // decrease speed 1 by one if flag 1 is 1.
bh_1_speed(add_bh1,speed1); // set motor 1 speed
if(speed2>=255)flag2=1; // set flag 2 to 1 when maximum speed 2 is reached.
else if(speed2<=0)
{
flag2=0; // set flag 2 to 0 when minimum speed 2 is reached.
dir2^=1; // change direction of motor 2 for
if(dir2==0)bh_2_ccw(add_bh1); // every speed 2 is equal to 0.
else bh_2_cw(add_bh1);
}
if(flag2==0)speed2++; // increase speed 2 by one if flag 2 is 0.
else speed2--; // decrease speed 2 by one if flag 2 is 1.
bh_2_speed(add_bh1,speed2); // set motor 2 speed
}
3.If it doesn't need an encoder, can i abort the SW2 programming which was related to encoder?