by Battwell » Sun Jul 08, 2018 12:36 pm
int carforwardport=2;
int carforwardpin=17;
int carreverseport=2;
int carreversepin=16;
//exec.Setoutpin (carreverseport,carreversepin);
exec.Wait(100);
exec.Setoutpin (carforwardport,carforwardpin);
for (int i=0; i<12; i++)
{
//wait for sensor off = movement
while (AS3.GetLED(4));
{
exec.Wait(10);
if (exec.Ismacrostopped())
{
exec.Clroutpin (carforwardport,carforwardpin);
exec.StopWithDeccel();
return;
}
}
Console.Beep();
exec.AddStatusmessage("off "+ i);
//sensor-off end
//wait for sensor on = next position
while (AS3.GetLED(4));
{
exec.Wait(10);
if (exec.Ismacrostopped())
{
exec.Clroutpin (carforwardport,carforwardpin);
exec.StopWithDeccel();
return;
}
}
exec.AddStatusmessage("on "+ i);
}
//exec.Wait(50);
exec.Clroutpin (carforwardport,carforwardpin);
exec.Clroutpin (carreverseport,carreversepin);
exec.Wait(10);
//sensor-on-position found end
return;