The code below works but i need just a few more loops in the code in order to get it to go exactly where i need it to any one know how i can make it start a new count after it gets past 254 so it doesnt loop, and i can add a few more steps to it, or does some one have a better way of doing this ? I got this way to work it just needs to run for a little bit longer.
Code:
void User_Autonomous_Code(void)
{
int count;
count = 1;
while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */
/*40ticks = 1 sec 20ticks = .5 secs 10ticks=.25 secs */ //increse counter by 1 /* DO NOT DELETE, or you will get no PWM outputs! *//*40ticks = 1 sec 20ticks = .5 secs 10ticks=.25 secs */
if ( count >= 124 ) {
}
if (count > 0 && count < 34 )
{
pwm05 = 60;
}
if (count > 35 )
{
pwm05 = 127;
}
if (count > 0 && count < 30 )
{
pwm04 = 0;
}
if (count > 32 )
{
pwm04 = 127;
}
if (count > 35 && count < 90 )
{
pwm01 = 190;
}
if (count > 35 && count < 90 )
{
pwm02 = 190;
}
if (count > 92 && count <= 122)
{
pwm01 = 190;
}
if (count > 92 && count <= 122)
{
pwm02 = 53;
}
if (count > 130 && count < 160 )
{
pwm01 = 190;
}
if (count > 130 && count < 160 )
{
pwm02 = 190;
}
if (count > 163 && count <= 183)
{
pwm01 = 190;
}
if (count > 163 && count <= 183)
{
pwm02 = 53;
}
if (count > 223 && count < 250 )
{
pwm01 = 190;
}
if (count > 223 && count < 250 )
{
pwm02 = 190;
}
if (count > 255 && count <= 275)
{
pwm01 = 190;
}
if (count > 255 && count <= 275)
{
pwm02 = 53;
}
++count;
Putdata(&txdata);
}
}
}
any help would be greatly appreciated.
__________________
If saftey is first and i put FIRST ahead of everything, then i must be the safest guy in the world.
Team 521 Alumni -- Team 1740 Mentor-- Go Go 1740!
Sometimes I think I've been doing this too long and other times I think I haven't done this enough... but all the times I'm sure I'm crazy
Photonics, It's Your Future