|
|
|
It is currently Thu May 23, 2013 12:49 am
|
View unanswered posts | View active topics | View unsolved topics
|
Page 1 of 1
|
[ 3 posts ] |
|
| Author |
Message |
|
mikehill100
Sergeant
Joined: Thu Jun 28, 2012 5:59 am Posts: 56
|
 Serial Port Question
I am doing some testing with the new serial port module. It is a little function that just reads incoming data. When it is reading it translates what I am sending (a, b, hello, etc.) into the ascii characters when I use readUntil() eg. "b" would read as 98. Using the readBytes() function will read "Yg==".
essentially:
textByte = readBytes(port2, 1) textUntil = readUntil(port2, "," 0) system.tag.writeToTag("Byte", textByte) # YQ== system.tag.writeToTag("Text", textUntil) # 97
Python uses chr("numbers") to translate from ascii to text and there is another utility bas64.base64("numbers") to translate from base64. Neither of these seem to work for me, but I am new to Python and could very well be missing a step.
any suggestions?
Thanks!
|
| Fri Jul 13, 2012 7:32 am |
|
 |
|
Kevin.Herron
Moderator
Joined: Mon Oct 27, 2008 4:10 pm Posts: 1342 Location: Folsom, CA
|
 Re: Serial Port Question
I seem to have missed the question in here, I think. Are you trying to convert the byte you read into a string?
_________________ Kevin Herron Software Developer Inductive Automation
|
| Fri Jul 13, 2012 7:40 am |
|
 |
|
Kevin.Herron
Moderator
Joined: Mon Oct 27, 2008 4:10 pm Posts: 1342 Location: Folsom, CA
|
 Re: Serial Port Question
Ok, actually I think I see the problem with readUntil(). I'll have to fix this for the next release.
_________________ Kevin Herron Software Developer Inductive Automation
|
| Fri Jul 13, 2012 8:04 am |
|
 |
|
|
Page 1 of 1
|
[ 3 posts ] |
|
Who is online |
Users browsing this forum: Google [Bot] and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|