Code:
switch(count)
{
case 2:
Relay2_green = 1;
Relay2_red = 0;
pwm03 = 127; //Motor stops when it reaches 1st level.
break;
case 3:
Relay2_green = 1;
Relay2_red = 0;
pwm03 = 127; //Motor stops when it reaches 2nd level.
break;
case 4:
Relay2_green = 1;
Relay2_red = 1;
pwm03 = 127; //Motor stops when it reaches top level.
break;
case 5:
Relay2_green = 0;
Relay2_red = 1;
//pwm03 does not equal 127 because it must pass the tape in order to go beneath the top level.
break;
case 6:
Relay2_green = 0;
Relay2_red = 1;
pwm03 = 127; //Motor stops when it retreats to 2nd level.
break;
case 7:
Relay2_green = 0;
Relay2_red = 1;
pwm03 = 127; //Motor stops when it retreats to 1st level.
break;
case 8:
Relay2_green = 0;
Relay2_red = 0;
pwm03 = 127; //Motor stops when it retreats to ground level.
count = 0;
break;
//if count == 1 then that just means that it passed through the first piece of tape which will be used to show that it is in full DOWN position.
}
Aight, so this is my switch.
Now, if I try to do the forwards/backwards thing, I wont have the correct relay lights, but I guess that would be ok. We could do without that. Also, I had a feeling that I would have a problem with the joysticks and setting the pwm value to 127. Could I use a timer? We'll see, thats another step for another day. THANKS AGAIN SO MUCH!!!