Package: serial-interface
AboutExample UsageInstallationDevelopmentAbout-Name: serial_interface-Description: Extends pyserial to make serial device interfaces.-Version: 2.3.1-Release Date: 2022-12-21-Creation Date: 2018-01-11-License: BSD-3-Clause-URL: https://github.com/janelia-pypi/serial_interface_python-Author: Peter Polidoro-Email: peter@polidoro.io-Copyright: 2022 Howard Hughes Medical Institute-References:-https://pyserial.readthedocs.io-Dependencies:-pyserialExample UsagePythonfromserial_interfaceimportSerialInterface,find_serial_interface_portsfind_serial_interface_ports()# Returns list of available serial portsdev=SerialInterface()# Might automatically find device if one available# if it is not found automatically, specify port directlydev=SerialInterface(port='/dev/ttyUSB0')# Linuxdev=SerialInterface(port='/dev/tty.usbmodem262471')# Mac OS Xdev=SerialInterface(port='COM3')# Windowsdev.get_device_info()fromserial_interfaceimportSerialInterfacesdevs=SerialInterfaces()# Might automatically find all available devices# if they are not found automatically, specify ports to usedevs=SerialInterfaces(use_ports=['/dev/ttyUSB0','/dev/ttyUSB1'])# Linuxdevs=SerialInterfaces(use_ports=['/dev/tty.usbmodem262471','/dev/tty.usbmodem262472'])# Mac OS Xdevs=SerialInterfaces(use_ports=['COM3','COM4'])# Windowsdevs.get_devices_info()devs.sort_by_port()dev=devs[0]dev.get_device_info()Command LineInstallationhttps://github.com/janelia-pypi/python_setupGNU/LinuxDriversGNU/Linux computers usually have all of the necessary drivers already installed, but users need the appropriate permissions to open the device and communicate with it.Udev is the GNU/Linux subsystem that detects when things are plugged into your computer.Udev may be used to detect when a serial device is plugged into the computer and automatically give permission to open that device.If you plug a sensor into your computer and attempt to open it and get an error such as: "FATAL: cannot open /dev/ttyUSB0: Permission denied", then you need to install udev rules to give permission to open that device.Udev rules may be downloaded as a file and placed in the appropriate directory using these instructions:99-platformio-udev.rulesDownload rules into the correct directorycurl-fsSLhttps://raw.githubusercontent.com/platformio/platformio-core/master/scripts/99-platformio-udev.rules|sudotee/etc/udev/rules.d/99-platformio-udev.rulesRestart udev management toolsudoserviceudevrestartUbuntu/Debian users may need to add own “username” to the “dialout” groupsudousermod-a-Gdialout$USERsudousermod-a-Gplugdev$USERAfter setting up rules and groupsYou will need to log out and log back in again (or reboot) for the user group changes to take effect.After this file is installed, physically unplug and reconnect your board.Python CodeThe Python code in this library may be installed in any number of ways, chose one.pippython3-mvenv~/venvs/serial_interfacesource~/venvs/serial_interface/bin/activate
pipinstallserial_interfaceguixSetup guix-janelia channel:https://github.com/guix-janelia/guix-janeliaguixinstallpython-serial-interfaceWindowsDriversDownload and install driver for the specific serial device.Python CodeThe Python code in this library may be installed in any number of ways, chose one.pippython3-mvenvC:\venvs\serial_interface
C:\venvs\serial_interface\Scripts\activate
pipinstallserial_interfaceDevelopmentInstall GuixInstall GuixClone Repositorygitclonehttps://github.com/janelia-pypi/serial_interface_pythoncdserial_interface_pythonEdit .metadata.orgmakemetadata-editsTangle .metadata.orgmakemetadataTest Python package using ipython shellmakeipython-shell# PORT=/dev/ttyUSB0# make PORT=/dev/ttyUSB1 ipython-shellimportserial_interfaceexitTest installation of Guix packagemakeinstalled-shell# PORT=/dev/ttyUSB0# make PORT=/dev/ttyUSB1 installed-shellexitUpload Python package to pypimakeuploadTest direct device interaction using serial terminalmakeserial-shell# PORT=/dev/ttyUSB0# make PORT=/dev/ttyUSB1 serial-shell?# helpsettings[C-a][C-x]# to exit