File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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()
7979import pymewc
8080pymewc.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
Original file line number Diff line number Diff line change 2222time .sleep (3 )
2323
2424
25-
2625def 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
112131def 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
Original file line number Diff line number Diff line change 55with open ("README.md" , "r" ) as fh :
66 LONG_DESCRIPTION = fh .read ()
77
8- VERSION = '0.1.3 '
8+ VERSION = '0.1.6 '
99DESCRIPTION = 'Microcontroller and python interface'
1010
1111# Setting up
You can’t perform that action at this time.
0 commit comments