python


Converting Serial data format using python


I am new to python,currently working on the project reading serial port from micro controller to capture sensor data. The serial data i received looks like this:
[5;17H 0.029[5;40H 0.736[5;63H 9.557[7;17H 0.038[7;40H 0.001 [7;63H 0.008[9;17H-34.199[9;40H 25.800[9;63H 13.799[14;17H -4.623[14;40H 0.597[14;63H218.920[19;14H
this serial data actually have escape sequence 'x1b' before open bracket. How do i get rid of them, escape sequence and text format(5;17H..) and just print sensor data x,y,z format line by line. Can somebody help me.. Thank you..
I'm using python serial code:
import serial
ser = serial.Serial('COM9', 115200, bytesize=8, timeout=0)
while True:
data = ser.read(size=8).decode("utf-8")
s = str(data)
print(data)
ser.close()
Sensor data record starts with \033, so split at this for instance:
data_list = data.split('\033')
for v in data:
print (v)

Related Links

Efficient way to fill 2d array in Python
How to set Plone to redirect to came_from after logout
loop appends last row n times to dict, instead of each row 1 time python
Division by 3 in Python
plot histogram in python using csv file as input
Running python script without installed libraries
In a django data model, is there any way to create a data field for each json attribute stored in a postgres table?
Updating an Existing XML Document in Python
Change in PANDAS .to_csv default formats? Or is it Anaconda?
URL does not work with formatted string but plain string does
Static class variables in Python — Lists & Objects [duplicate]
Python, Heroku & Memcachier - access settings.py variable
os.listdir outputting different files than there are in the folder
Python iterator not working as anticipated
Form placeholder in django doesn't show properly
How the OS handles python and subprocesses of a python script…?

Categories

HOME
makefile
visual-studio-2015
rest
symfony
payment-gateway
openssl
crate
wildcard
cpu-architecture
parse-server
phpstorm
sequelize.js
contact-form-7
deeplearning4j
octopus-deploy
click
aspell
off-canvas-menu
pyephem
derived
internet-explorer-8
ios10.3
jni
sql-update
google-maps-android-api-2
url.action
onsen-ui
azure-servicebus-queues
nmf
yosys
iis-10
excel-2013
chrome-native-messaging
i3
dpi
winscp
blackboard
smart-mobile-studio
pdflatex
spreedly
remote-server
css-counter
openshift-enterprise
mmdrawercontroller
broadleaf-commerce
npm-publish
poco-libraries
concrete5-5.7
parent
bayesian-networks
nashorn
html-agility-pack
rich-text-editor
apiary
startapp
rdw
floor
range-v3
drawingarea
text-classification
modelattribute
jszip
collapsingtoolbarlayout
emoticons
addin-express
vici
pdfkit
slam-algorithm
json-schema-validator
zurb-foundation-apps
spoofing
scalar
com-interop
logcat
proxygen
base32
integral
sparse-file
xaml-designer
google-plus-one
code-first-migrations
viewflipper
sysctl
line-numbers
temp-tables
and-operator
dto
outline
mfmailcomposeviewcontroll
colt
uipickerviewcontroller
wic
.net-cf-3.5
shiva3d
qtgui
fileconveyor
vertical-scrolling
wpdb
pys60
shim
separation-of-concerns
flexicious
qtembedded
paintcomponent
requestfactory
j-interop
camtasia
oggvorbis
plinq
virtualquery

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App