From ac98a5cafcba70d99f8e757ca4b49672f5742494 Mon Sep 17 00:00:00 2001 From: CloudyPadmal Date: Thu, 9 May 2019 00:09:57 +0530 Subject: [PATCH] feat: compatibility with Windows --- PSL/packet_handler.py | 5 +++-- README.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) mode change 100644 => 100755 PSL/packet_handler.py diff --git a/PSL/packet_handler.py b/PSL/packet_handler.py old mode 100644 new mode 100755 index a4f6d79f..3dce7157 --- a/PSL/packet_handler.py +++ b/PSL/packet_handler.py @@ -49,8 +49,9 @@ def listPorts(self): available = [] for i in range(256): try: - s = serial.Serial(i) - available.append(i) + portname = 'COM' + str(i) + s = serial.Serial(portname) + available.append(portname) s.close() except serial.SerialException: pass diff --git a/README.md b/README.md index 21d3c43b..19de7d2b 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,41 @@ For the main GUI (Control panel), you can run Experiments from the terminal. $ Experiments + +### Installing PSLab Python library without GUI + +If a user wants to install the python library to have a command line interface to execute commands, he can do so by simply installing the dependencies and latest Python versions. + +#### Windows + +##### Dependencies + +* Python 2.7 or Python 3.7 [Link to Official download page](https://www.python.org/downloads/windows/) +* Pip +* PySerial +* Numpy + +##### Instructions + +1. Install the latest Python version on your computer and configure `PATH` variable to have both Python installation directory and the Scripts directory to access `pip` tools. +2. Open up command prompt and execute the command `pip install pyserial && pip install numpy` to install the required dependencies. + +##### Validate + +1. Download the PSLab-Python library from this repository and extract it to a directory. +2. Browse in to that directory and create a new file named `test-pslab-libs.py` +3. Paste the following code into that file and save it. + +``` +from PSL import sciencelab +I = sciencelab.connect() +capacitance = I.get_capacitance() +print(capacitance) +``` + +4. Plug in the PSLab device and check if both the LEDs are turned on. +5. Now run this file by typing `python test-pslab-libs.py` on a command prompt and observe a numerical value printed on the screen along with PSLab device version and the port it is connected to. + ----------------------- #### Development Environment pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy