getLed() for IndustrialAutomation python

mikemick

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)
0.0
>>> 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 __init__.py 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?
 

alexburcea

Moderator
Staff member
Hi,

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)
0
>>> i.setLed(0, 1, 1)
>>> i.getLed(0, 1)
1
>>> i.setLed(0, 2, 1)
>>> i.getLed(0, 1)
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.
 

mikemick

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!!

Mike
 
Top