Differences between revisions 1 and 2
Revision 1 as of 2011-03-10 15:40:51
Size: 2196
Editor: h118244
Comment:
Revision 2 as of 2011-03-10 19:57:10
Size: 2286
Editor: h118244
Comment:
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
pls look at this post using "source txt"or"bron txt" button rigth top for better lay-out

Asking for Help: ...

system: ubuntu connected to a serial port connected datalogger pls look at this post using "source txt"or"bron txt" button rigth top for better lay-out

python program


#! /usr/bin/env python import serial import time ser = serial.Serial('/dev/ttyS0',9600, bytesize=8, timeout=9) ser.open() if ser.isOpen():

  • ser.write( b'\x1b' ) #this is the binary format for chr(27) esc #time.sleep(1) response = ser.read(ser.inWaiting()) data = ser.readlines()

#data = data.split() f = open('../../../minicom/python.txt', 'a') s = str(data) f.write(s) f.close() data.Sstrip("\n\r") print data ser.close() print "port closed"


sample of the data received '10-3-11\t15:28\t23,8\t14,4\t0\r\n', '10-3-11\t15:35\t12,0\t13,5\t8\r\n', '10-3-11\t15:45\t12,0\t14,0\t1\r\n', '10-3-11\t15:46\t12,0\t14,0\t0\r\n', '10-3-11\t15:55\t12,0\t13,5\t11\r\n', '10-3-11\t16:4\t12,0\t13,5\t0\r\n', '10-3-11\t16:5\t23,8\t14,4\t0\r\n', '10-3-11\t16:5\t12,0\t13,5\t2\r\n', '10-3-11\t16:6\t12,0\t13,5\t0\r\n']

data should look like this example 10-3-11 14:31 21,9 4,2 0 10-3-11 14:33 11,7 13,5 11 10-3-11 14:39 11,7 13,5 0 10-3-11 14:39 24,8 14,4 0 10-3-11 14:39 8,5 18,9 0 10-3-11 14:44 11,7 13,5 10 10-3-11 14:54 12,0 13,0 5 10-3-11 15:4 12,0 13,5 10 10-3-11 15:8 12,0 13,5 0 10-3-11 15:9 23,8 14,4 0 10-3-11 15:14 12,0 13,5 5 10-3-11 15:16 12,0 13,5 0 10-3-11 15:17 23,8 14,4 0 10-3-11 15:18 11,7 18,9 0

is there anyone with a similar problem fspr

When answering questions, add the CategoryAskingForHelpAnswered category when saving the page. This will move the link to this page from the questions section to the answers section on the Asking for Help page.


CategoryAskingForHelp

Asking for Help/remove escape characters (last edited 2011-03-10 22:43:51 by PaulBoddie)

Unable to edit the page? See the FrontPage for instructions.