Dear all,
I am using python 2.5 and pyserial 2.5
i wanna help in writing simple code in python where i wanna separate string
i am getting string in this format
---------
time and date:11/3/2013 11:10:5
dir:fwd
actual position : 30
desire position :28
---------
i wanna write this in to excel sheet for every 10 min such away that in column c1:time and date c2: dir, c3: actual position c4: desire position
in row i could able to write time,dir,AP,DP one after the other. how can i write in to excel sheet
i have written below code to write in to text file.
Code:
import serial
import csv
import os
import time
def main():
pass
if __name__ == '__main__':
main()
COUNT=0
while(COUNT<=60):
ser=serial.Serial()
ser.port=12
ser.baudrate=9600
ser.open()
x=ser.read(150)
foo=open("time.txt","a+");
print x
foo.write(x)
foo.write("\n")
foo.close();
ser.close()
time.sleep(60)
COUNT=COUNT+1
if(COUNT==60):
COUNT=0