Creating an LED with the API

When you create an LED with the API, you must provide its type, which can be set through the constructor or through the setAttributeValue method.

How to create an LED with the API

The following sample shows how to create an LED of type Circular.
List objects = new ArrayList();
// create shelf identified as myShelf
IltShelf s1 = new IltShelf("myShelf");
s1.setSlotSizes(2,50,1,100);
objects.add(s1);
 
// create card
IltCard c1 = new IltCard(new IltOSIObjectState(), "card 1");
c1.setPosition(new IlpShelfItemPosition(0, 0, 1, 1));
objects.add(c1);
 
// create card item
IltLed l1 = new IltLed("myLed");
l1.setType(IltLed.Type.Circular);
l1.setPosition(new IlpRelativePoint(25,85));
objects.add(l1);
 
// add all objects to data source
datasource.addObjects(objects);
The result looks like this:
ledwithapi101.gif
A shelf containing a card with an LED