Skip to content

Commit 4dab77e

Browse files
authored
feat: compatibility with Windows (fossasia#92)
1 parent 24c57a0 commit 4dab77e

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

PSL/packet_handler.py

100644100755
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ def listPorts(self):
4949
available = []
5050
for i in range(256):
5151
try:
52-
s = serial.Serial(i)
53-
available.append(i)
52+
portname = 'COM' + str(i)
53+
s = serial.Serial(portname)
54+
available.append(portname)
5455
s.close()
5556
except serial.SerialException:
5657
pass

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,41 @@ For the main GUI (Control panel), you can run Experiments from the terminal.
6262

6363
$ Experiments
6464

65+
66+
### Installing PSLab Python library without GUI
67+
68+
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.
69+
70+
#### Windows
71+
72+
##### Dependencies
73+
74+
* Python 2.7 or Python 3.7 [Link to Official download page](https://www.python.org/downloads/windows/)
75+
* Pip
76+
* PySerial
77+
* Numpy
78+
79+
##### Instructions
80+
81+
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.
82+
2. Open up command prompt and execute the command `pip install pyserial && pip install numpy` to install the required dependencies.
83+
84+
##### Validate
85+
86+
1. Download the PSLab-Python library from this repository and extract it to a directory.
87+
2. Browse in to that directory and create a new file named `test-pslab-libs.py`
88+
3. Paste the following code into that file and save it.
89+
90+
```
91+
from PSL import sciencelab
92+
I = sciencelab.connect()
93+
capacitance = I.get_capacitance()
94+
print(capacitance)
95+
```
96+
97+
4. Plug in the PSLab device and check if both the LEDs are turned on.
98+
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.
99+
65100
-----------------------
66101

67102
#### Development Environment

0 commit comments

Comments
 (0)
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