So, after playing with the onionGpio module a bit more, I've reluctantly concluded that I can't use it to read gpio input that's reliable enough to do things like read a rotary encoder, even after fixing the bug in what it returns for getValue(). The trouble is partly that reading a pin is really slow because the implementation uses file manipulation and file I/O to read the bit in a hardware register somewhere that represents the pin. And partly it's because Python, being a garbage-collecting language, might take a break from executing your code to do a bunch of housekeeping between one of line of your code and the next. (Maybe it's possible to tell the Python environment to hold off on housekeeping stuff for a section of code. Some languages that garbage collect let you do that. I wouldn't know. But doing a getValue() executes a lot of code, as I said.)
That means, for example, that if you're trying to decide which pin went HIGH first, pin1 or pin2, you can't do it reliably at the millisecond level by doing
@Joris-Mulliez I agree that PHP is of no use here, however I have plans to take this further, and wanted to start with the PHP base to work into. I am taking small steps into this whole new computing world for me. Yes, I could have just had the Python write out to "index.htm" and left it there, however what I am now doing is even beyond that. I want the initial page to allow for the selection of ZIP, City, PWS, Lat/Long and to set the refresh rate. This is only a backbone to grow from.
I know this is an old thread but I just got HomeAssistant running on my Omega2+ and wanted to follow up. I did the following;
I factory reset my Omega2+ to latest software/console
I extended the storage to use the SD card (3GB)
I added a 250MB swap file to extend the memory
I installed python 3, pip3 and upgraded pip3 setuptools
I also didn't use virtualenv. HomeAssistant installed and ran without any special changes and I could view the UI at http://omega-xxxx.local:8123/. It did take a very long time (20 mins) to install and run though.
Like Vinicius said, if you have no real reason to use something like C and can get away with python, if it is not crucial to have a fast initialization time, I would go with Python. Also, the difference between python 2 and 3 is minimal. Really 3 is just making things a little more consistent. Mostly if you change your print "ok" to print("ok") that should do it. I would go with python 2.
One suggestion. I have found that it is faster to use os.system() for some things rather than their python equivalents. Perhaps you could look into that?
@Alan-Smith Right now we are still writing a wrapper for the OLED library. However, we do have an older version of a python library for the OLED here: https://github.com/OnionIoT/Python-OLED. However, this library uses smbus, which we haven't had a chance to compile for the Omega yet. If you are feeling adventures you can try to compile it.
@Rudy-Trujillo We are still working on python wrappers for our libraries. So at this point it might be easier for you to use the Linux command line to control the pins. You can try the fast-gpio utility.