getLed() for IndustrialAutomation python


New member
I have been using python3 to program the SM Industrial Automation card. I've tried to use the getLet() function but it doesn't seem to be in the megaind python library. Here is a trace of what happens at REPL level:

Python 3.7.3 (default, Oct 31 2022, 14:04:00)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import megaind
>>> megaind.get0_10In(0, 1)
>>> megaind.getLed(0, 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'megaind' has no attribute 'getLed'

I have looked at the in ~/megaind-rpi/python/megaind and the getLet() function is included. Not sure if I'm using the library incorrectly.
Can you shed some light on this?


Staff member

The "getLed(stack, led)" is in the library, here a example:
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import megaind as i
>>> i.getLed(0, 1)
>>> i.setLed(0, 1, 1)
>>> i.getLed(0, 1)
>>> i.setLed(0, 2, 1)
>>> i.getLed(0, 1)
>>> exit()

Please make sure you are using the last megaind library. Do a update of the megaind-rpi repository and reinstall the library as per instructions.
Let me know the result.


New member
Thanks for the quick reply. I updated the python3 system on my pi4 -- to Python 3.10.11, and also reinstalled the megaind package.
I now get the desired result, as in the lines that you quoted. Thanks much!!