Hello everybody! I have an interesting dilemma!
I have mapped the IR board to Digital Input 1-4 on the RC, and called these to be read in Autonomous.
Now, When a button is pressed on the remote in Hybrid, the status of the variable won’t change. Though if I am holding the button and reset the robot the variable changes?!
I do not believe that Autonomous is being called after the first routine. As in, I think it’s just doing the default and kicking out, rather than looking for the variable.
I am including the code for the autonomous (I program in EasyC and am using the code box on the right to copy this, by hand, my laptop has not network.) I only copied 1 output code, the others are copied from the “IF (Out0 =1)” block, and modified for their function
#include "Main.h"
void Autonomous (void)
{
unsigned char Out0 = 0 //IR Output 0
unsigned char Out1 = 0 //IR Output 1
unsigned char Out2 = 0 //IR Output 2
unsigned char Out3 = 0 //IR Output 3
signed char count = 0 //Smart Counter
while (1 == 1)
{
Out0 = GetDigitalInput (1);
Out1 = GetDigitalInput (2);
Out2 = GetDigitalInput (3);
Out3 = GetDigitalInput (4);
if (Out0 = 0)
{
if (Out1 = 0)
{
if (Out2 = 0)
{
if (Out3 = 0)
{
// ADD DRIVE CODE HERE
for (count; count = 0; count ++)
{
Wait (300);
}
for (count; count = 1; count ++)
{
Wait (200);
}
for (count; count = 2; count ++)
{
Wait (200);
}
for (count; count = 3; count ++)
{
Wait (200);
}
for (count; count = 4; count ++)
{
Wait (1500);
}
for (count; count = 5; count ++)
{
Wait (500);
}
for (count; count = 6; count ++)
{
Wait (500);
}
for (count; count = 7; count ++)
{
//STOP HERE!
}
}
}
}
}
if (Out0 ==1) //Button 1 pressed
{
Out1 = 0;
Out2 = 0;
Out3 = 0;
SetDigitalOutput (15, 1) // LED1 ON
SetDigitalOutput (16, 0) //LED2 OFF
SetDigitalOutput (17, 0) // LED 3 OFF
SetDigitalOutput (18, 0) //LED4 OFF
if (count <=3)
{
//SET RELAYS OFF!!!
count = 4;
}
else
{
count = count;
}
break;
}
}
//COPY OUT0 AND MODIFY FOR OTHER MODES
// END AUTO
}