Without detailed information on what you want to happen, it's difficult to know exactly what you want.
You need to write a macroloop to monitor the sensor.
Not sure how you plan on homing the carousel, and setting the initial field to 1.
Your macro loop would be something like this, after the homing.
- Code: Select all
while(loop)
{
int toolno = Getfield(fieldnumber) ; // Get current value of field
if GetLED(xx) // If the LED for the sensor input is active...
{
toolno = toolno + 1; // When the sensor is triggered, add 1 to the tool number.
AS3.Setfield( toolno, fieldnumber);
AS3.Validatefield (fieldnumber);
}
Thread.Sleep(50)
}
You'll probably need to check if the tool number = 22, then reset it to 1