I am using FSMs to make presets for my arm and it is cycling through the cases to fast and I don’t know how to delay it.
I tried it virtually with enums as numbers on debug stream line and it skips states it looks like. Here is my code.
enum Presets
{
Low,
High,
HighScored,
LowScored,
Down
};
Presets preset;
void Arm()
{
writeDebugStreamLine(“%d”, preset, 1);
switch(preset)
{
case Down:
if(vexRT[Btn6U] == 1)
{
preset = Low;
}
else if(vexRT[Btn6D] == 1)
{
preset = LowScored;
}
break;
case Low:
if(vexRT[Btn6U] == 1)
{
preset = High;
}
if(vexRT[Btn6D] == 1)
{
preset = LowScored;
}
break;
case High:
if(vexRT[Btn6U] == 1)
{
preset = Low;
}
else if(vexRT[Btn6D] == 1)
{
preset = HighScored;
}
break;
case LowScored:
if(vexRT[Btn6U] == 1)
{
preset = Low;
}
else if(vexRT[Btn6D] == 1)
{
preset = Down;
}
break;
case HighScored:
if(vexRT[Btn6U] == 1)
{
preset = High;
}
else if(vexRT[Btn6D] == 1)
{
preset = Down;
}
break;
}
}