I have inserted a sample RR program and the cscript used that I have found to crash once I insert in a Lego NXT module. I have taken part of the example for the Red Object Detection for a test. As you will see in the sample, when you move a red object to the directions up, down, left, right or center, the variable direction changes. As a key, 1 is up, 2 is down, 3 is left, 4 is right and 5 is center.
I am testing to control my robot's movements by moving a red ball. The program is working, but it crashes after I specify the direction variable and click "send".
I have tested the module by itself, not within any program. There is no problem, it works as it should.
Fore reference this is my NXC source code for the receiving end of the program:
//up 1, down 2, left 3, right 4, center 5
task main()
{
int i;
while(true) {
ReceiveRemoteNumber(0, true, i);
NumOut(0, LCD_LINE1, i);
switch(i)
{
case 1:
OnFwdReg(OUT_AC, 40, OUT_REGMODE_SPEED);
break;
case 2:
OnRevReg(OUT_AC, 40, OUT_REGMODE_SPEED);
break;
case 3:
OnFwd(OUT_C, 40);
Off(OUT_A);
break;
case 4:
OnFwd(OUT_A, 40);
Off(OUT_C);
break;
case 5:
Off(OUT_AC);
}
}
}
*the mailbox specified 0 is 1 in RR and NXT-G
|
|