Skip to content

Commit 1a20fd1

Browse files
committed
0.1.6
1 parent 0b849f3 commit 1a20fd1

3 files changed

Lines changed: 31 additions & 7 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## _Making your microcontroller connect with python_
44

5-
_version:0.1.3 Beta_
5+
_version:0.1.6 Beta_
66

77
[![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://travis-ci.org/joemccann/dillinger)
88
[![PyPI - License](https://img.shields.io/pypi/l/length)](https://raw.githubusercontent.com/Ratheshprabakar/length/master/LICENSE.md)
@@ -79,6 +79,11 @@ pymewc.blink()
7979
import pymewc
8080
pymewc.serial()
8181
```
82+
**For printing what the serial monitor prints without infinity loop condition specify no. of data to be displayed:**
83+
```sh
84+
import pymewc
85+
pymewc.serial_discrete()
86+
```
8287

8388
**For scoping using analog pin A0 (Currently default value is A0 other analog pin values are under development) :**
8489

pymewc/__init__.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
time.sleep(3)
2323

2424

25-
2625
def serial():
2726
com_port = input("Enter the com-port(Com4 or /dev/ttyACM0 on Windows and Unix based respectively)")
2827
baud_rate = int(input("Enter the baud rate as specified in the .ino file"))
@@ -34,13 +33,33 @@ def serial():
3433

3534
while(1):
3635
try:
37-
x = (ser.readline().strip())
38-
print("Check the usb port is mentioned correctly or usb is connected properly")
36+
x = (ser.readline().strip())
3937
y = (x.decode('utf-8'))
4038
print(y)
4139

4240
except UnicodeDecodeError:
43-
continue
41+
print("Check the usb port is mentioned correctly or usb is connected properly")
42+
continue
43+
44+
def serial_discrete():
45+
inp = int(input("Enter the no. of datas to be streamed"))
46+
com_port = input("Enter the com-port(Com4 or /dev/ttyACM0 on Windows and Unix based respectively)")
47+
baud_rate = int(input("Enter the baud rate as specified in the .ino file"))
48+
import serial
49+
try:
50+
ser = serial.Serial(com_port, baud_rate)
51+
except error:
52+
print("Check the usb port is mentioned correctly or usb is connected properly")
53+
54+
for i in range(0,inp):
55+
try:
56+
x = (ser.readline().strip())
57+
y = (x.decode('utf-8'))
58+
print(y)
59+
60+
except UnicodeDecodeError:
61+
print("Check the usb port is mentioned correctly or usb is connected properly")
62+
continue
4463

4564

4665

@@ -110,5 +129,5 @@ def blink():
110129

111130

112131
def hello():
113-
print("Hello world, The package is properly installed version = 0.1.3")
132+
print("Hello world, The package is properly installed version = 0.1.6")
114133

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
with open("README.md", "r") as fh:
66
LONG_DESCRIPTION= fh.read()
77

8-
VERSION = '0.1.3'
8+
VERSION = '0.1.6'
99
DESCRIPTION = 'Microcontroller and python interface'
1010

1111
# Setting up

0 commit comments

Comments
 (0)