I'm using a Raspberry Pi 3 to communicate with a GSM module over the GPIO pins. The operating system on the Pi is Raspbian Stretch. It has Python 2.7 installed. The standard way to communicate over the GPIO is using the serial library in Python which is pre-installed. I'm just trying to find the documentation for this library and can't find it anywhere.
Where is it?
I've tried googling for it and it only turns up a library called pyserial and examples of people using and trying to use the serial library but no documentation for it in sight.
I think the library serial is a bit too new, and since it has been developed by one single person, it might take time to get some documentation. What you can do is to have a quick overview of the project and its source code: https://bitbucket.org/davebelais/serial
I turns out it's at
https://pythonhosted.org/pyserial/
which is where you end up when you're googling, but I naturally ignored it assuming that the name of the library would be whatever you write in the import statement. Clearly this doesn't hold for python.
Related
I am looking to connect to a car wirelessly using socketCAN protocol on MacOS using the module python-can on python3. I don't know how to install the socketCAN protocol on MacOS. Pls help.
This cat managed to get it basically working:
socketcanx
I have compiled it on my hackintosh (running Mojave) and it works from the terminal. I have not played around with it more than that, as it was just easier to use Liunx in a VM or docker or one of my Linux machines. When compiled, I was able to use all of my makeshift CAN devices and a USB2CAN device without issue. I am sure with some work, it can be used with Python-CAN, though you would need to write your own interface module for Python-CAN. As far as I can tell, it should work more or less the same, though the code is old (4 years since last update).
As stated in the accepted answer, you can use a native CAN device that is compatible with macOS and as long as it's compatible with Python-CAN, then you are good to go (or if it works on mac and not compatible, you can create and interface for the device and submit a pull-request on github for Python-CAN).
SocketCAN is implemented only for the Linux kernel. So it is not available on other operating systems. But as long as your CAN adapter is supported by python-can, you don't need SocketCAN.
I'm trying to write some code that will fetch receive data from usb HID devices like scales. I've used pywinusb for windows but I need it to be cross platform. pyhid says it's just for Mac OS X. The only cross-platform module I've found so far is libhid which is written in C but still python accessible. However, I haven't found any helpful internet sources on how to use it in python.
All I need to do is read the weight from usb scales.
Are there any other cross-platform python HID modules>?
Have you tried cython-hidapi? It is a cython wrapper around the excellent hidapi C library.
The PyPi page report that it works on POSIX, Mac OS X, and Windows operating systems.
I'm wondering is that possible to control lights connected to Enttec Open DMX USB via Python shell. If it is, how to?
The Open Lighting Project (formerly known as opendmx) provides a Python API, as part of their Open Lighting Architecture (OLA), for use the OpenDMX USB on OSX and Linux. If you're on Windows then I've not found anything apart from the code from Enttec's website which uses the FTD2XX.DLL libraries.
However it should be noted that one cannot use normal serial based libraries (pyserial etc). Basically OLA either needs to use a special kernel module on Linux, or use the generic FTDI non-serial kernel driver in combination with libftdi on Mac or Linux - for details see their device specific page. There is now pre-built support for Raspberry Pi's on the OLA website.
The communication and protocols used are completely different from Enttec Pro range (which one can just control using simple serial commands with something like pyserial, though OLA also talks to them too).
I know this is quite an old post, however DmxPy has worked very well for me the last few months. It only works for Python 2 but I know there's some Python 3 ports out there.
It's stupid simple to use. I personally use it in my companies quality control software. While it only work for DMX (not RDM) I think it's much easier to use than OLA's Python Wrapper. It works flawlessly with our ENTTEC as well!
UPDATE: Here's my Python 3 port: https://github.com/trevordavies095/DmxPy
I had the exact same problem, so I wrote a simple python programm for all those that are running windows; have a look: https://github.com/Coronon/PyOpenDmxUsb
It uses a C# Server (Because their C# interface was the only one that worked for me) and a Python Client and is super easy to use.
It is compatible with the non pro version too. (The Pro Version is way easier to use and I would use the AcceptedAnswer instead [But the normal one isnt supported])
Edit: This may be 'advertisement' but my project is Open-Source and super easy to use, so I believe this can be useful to others :)
Is there a simple way to get the pen pressure data from a usb tablet using python on Linux?
You can do it by reading input events on the input device node. I wrote some modules to do this. you can find it in the Pycopia project.
The disadvantage of this is that your program must run as root.
The powerdroid project also uses this, but that's old code now. You can see another example of synthesizing touch input in the devices module. It probably won't work anymore, but you might start with that.
Try using PySide, it's a QT Wrapper here: QTabletEvent.
Or you can use Python and PyGame: Here.
I'm trying to write some code using OpenCV. My sensor is from Point Grey Systems, and it uses the FlyCapture API to grab images. I'd like to grab those images and do some stuff in OpenCV to them, using Python. FlyCapture is all C/C++, so I'm firing up SWIG to create the bindings. Am I reinventing the wheel? Do python bindings for FlyCapture already exist somewhere that I don't know about?
As of FlyCapture 2.11 there are official Point Grey / FLIR python wrappers. I've used the python 2.7 so far.
the pyflycapture2 is still available as well...
just started using this wrapper last week pyflycapture2
working well so far with my FireFly MV USB
Here's a new Cython wrapper I started for the FlyCapture V1 API:
https://github.com/kbrafford/pyfly1
It also has some wx.Python demos showing it working and allowing you to assess performance.
If the Python language is your only restriction, you may use the wrappers for FlyCapture from the JavaCPP Presets by calling the appropriate functions via Jython.