python pyserial readline not working, but screen kinda does, worked in ubuntu 16
I have a script which monitors the serial com port:
nano spo.py:
#!/usr/bin/env python3
import serial, time
ser = serial.Serial('/dev/ttyS0', 9600)
while 1:
serial_line = ser.readline()
print(serial_line)
time.sleep(60)
ser.close()
ctrl+x to save and exit
chmod +x spo.py
./spo.py
This script worked under Ubuntu 16, that system may have been an older version of python as well.
under Ubuntu 18.04 I am not getting serial output now, assuming either because of newer Ubuntu, or the newer version of python it comes with.
EDIT, I found a way to get SOME output while running my script (while the script is running I powered the device off and on a couple times):
b'NONIN AVANT 9600rn'
b'NONIN AVANT 9600rn'
b'NONIN AVANT 9600rn'
the above is formatted differently than it used t be though:
NONIN AVANT 9600
if I use screen, i get a bit more butonly if i hit enter
screen /dev/ttyS0 9600
then every time I hit enter I get the initial data:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:52:32
SpO2= 96 HR= 62 F
if I hit enter again I get more, but it starts over isntead of showing the next line:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:53:55
SpO2= 97 HR= 65 F
under Ubuntu 16 on my old install from years ago, the output would be like this, initializing once and then getting a new stats line every second:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:53:55
SpO2= 97 HR= 65 F
SpO2= 98 HR= 69 F
SpO2= 96 HR= 70 F
SpO2= 98 HR= 74 F
SpO2= 97 HR= 63 F
SpO2= 96 HR= 62 F
SpO2= 95 HR= 64 F
I only get the re-initialized output that I do in screen if I hit the enter key.
I am hoping somebody can help me figure this out, I feel like I am going round and round in circles chasing dead ends.
The device is a Nonin Avant 9600: ASCII serial 9600 baud with 8 databits, 1 start bit, and 2 stop bits. Each line is terminated by CR/LF
python serial-port readline pyserial tty
add a comment |
I have a script which monitors the serial com port:
nano spo.py:
#!/usr/bin/env python3
import serial, time
ser = serial.Serial('/dev/ttyS0', 9600)
while 1:
serial_line = ser.readline()
print(serial_line)
time.sleep(60)
ser.close()
ctrl+x to save and exit
chmod +x spo.py
./spo.py
This script worked under Ubuntu 16, that system may have been an older version of python as well.
under Ubuntu 18.04 I am not getting serial output now, assuming either because of newer Ubuntu, or the newer version of python it comes with.
EDIT, I found a way to get SOME output while running my script (while the script is running I powered the device off and on a couple times):
b'NONIN AVANT 9600rn'
b'NONIN AVANT 9600rn'
b'NONIN AVANT 9600rn'
the above is formatted differently than it used t be though:
NONIN AVANT 9600
if I use screen, i get a bit more butonly if i hit enter
screen /dev/ttyS0 9600
then every time I hit enter I get the initial data:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:52:32
SpO2= 96 HR= 62 F
if I hit enter again I get more, but it starts over isntead of showing the next line:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:53:55
SpO2= 97 HR= 65 F
under Ubuntu 16 on my old install from years ago, the output would be like this, initializing once and then getting a new stats line every second:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:53:55
SpO2= 97 HR= 65 F
SpO2= 98 HR= 69 F
SpO2= 96 HR= 70 F
SpO2= 98 HR= 74 F
SpO2= 97 HR= 63 F
SpO2= 96 HR= 62 F
SpO2= 95 HR= 64 F
I only get the re-initialized output that I do in screen if I hit the enter key.
I am hoping somebody can help me figure this out, I feel like I am going round and round in circles chasing dead ends.
The device is a Nonin Avant 9600: ASCII serial 9600 baud with 8 databits, 1 start bit, and 2 stop bits. Each line is terminated by CR/LF
python serial-port readline pyserial tty
add a comment |
I have a script which monitors the serial com port:
nano spo.py:
#!/usr/bin/env python3
import serial, time
ser = serial.Serial('/dev/ttyS0', 9600)
while 1:
serial_line = ser.readline()
print(serial_line)
time.sleep(60)
ser.close()
ctrl+x to save and exit
chmod +x spo.py
./spo.py
This script worked under Ubuntu 16, that system may have been an older version of python as well.
under Ubuntu 18.04 I am not getting serial output now, assuming either because of newer Ubuntu, or the newer version of python it comes with.
EDIT, I found a way to get SOME output while running my script (while the script is running I powered the device off and on a couple times):
b'NONIN AVANT 9600rn'
b'NONIN AVANT 9600rn'
b'NONIN AVANT 9600rn'
the above is formatted differently than it used t be though:
NONIN AVANT 9600
if I use screen, i get a bit more butonly if i hit enter
screen /dev/ttyS0 9600
then every time I hit enter I get the initial data:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:52:32
SpO2= 96 HR= 62 F
if I hit enter again I get more, but it starts over isntead of showing the next line:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:53:55
SpO2= 97 HR= 65 F
under Ubuntu 16 on my old install from years ago, the output would be like this, initializing once and then getting a new stats line every second:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:53:55
SpO2= 97 HR= 65 F
SpO2= 98 HR= 69 F
SpO2= 96 HR= 70 F
SpO2= 98 HR= 74 F
SpO2= 97 HR= 63 F
SpO2= 96 HR= 62 F
SpO2= 95 HR= 64 F
I only get the re-initialized output that I do in screen if I hit the enter key.
I am hoping somebody can help me figure this out, I feel like I am going round and round in circles chasing dead ends.
The device is a Nonin Avant 9600: ASCII serial 9600 baud with 8 databits, 1 start bit, and 2 stop bits. Each line is terminated by CR/LF
python serial-port readline pyserial tty
I have a script which monitors the serial com port:
nano spo.py:
#!/usr/bin/env python3
import serial, time
ser = serial.Serial('/dev/ttyS0', 9600)
while 1:
serial_line = ser.readline()
print(serial_line)
time.sleep(60)
ser.close()
ctrl+x to save and exit
chmod +x spo.py
./spo.py
This script worked under Ubuntu 16, that system may have been an older version of python as well.
under Ubuntu 18.04 I am not getting serial output now, assuming either because of newer Ubuntu, or the newer version of python it comes with.
EDIT, I found a way to get SOME output while running my script (while the script is running I powered the device off and on a couple times):
b'NONIN AVANT 9600rn'
b'NONIN AVANT 9600rn'
b'NONIN AVANT 9600rn'
the above is formatted differently than it used t be though:
NONIN AVANT 9600
if I use screen, i get a bit more butonly if i hit enter
screen /dev/ttyS0 9600
then every time I hit enter I get the initial data:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:52:32
SpO2= 96 HR= 62 F
if I hit enter again I get more, but it starts over isntead of showing the next line:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:53:55
SpO2= 97 HR= 65 F
under Ubuntu 16 on my old install from years ago, the output would be like this, initializing once and then getting a new stats line every second:
NONIN AVANT 9600
Patient:
Clinician:
09/01/04 12:53:55
SpO2= 97 HR= 65 F
SpO2= 98 HR= 69 F
SpO2= 96 HR= 70 F
SpO2= 98 HR= 74 F
SpO2= 97 HR= 63 F
SpO2= 96 HR= 62 F
SpO2= 95 HR= 64 F
I only get the re-initialized output that I do in screen if I hit the enter key.
I am hoping somebody can help me figure this out, I feel like I am going round and round in circles chasing dead ends.
The device is a Nonin Avant 9600: ASCII serial 9600 baud with 8 databits, 1 start bit, and 2 stop bits. Each line is terminated by CR/LF
python serial-port readline pyserial tty
python serial-port readline pyserial tty
edited Nov 26 '18 at 11:52
xekon
asked Nov 26 '18 at 10:51
xekonxekon
5210
5210
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
For anybody that finds this thread. I had tried several different ways of getting output from the serial port, nothing was working. I was using our backup oximeter to test with. I switched out the oximeter for the one we normally use, and now serial communication is working properly. The bad oximeter appeared to be functioning correctly and displayed correctly on its screen, so I would not have guessed it might have been the device causing the problem with the serial communication.
Also oddly, turning the device off and on gets me some data out of the serial port, but only initially, I don't keep getting data. I almost gotta wonder if its just a setting or something weird with the device, but I looked the manual over and don't see anything. Wish I knew a little bit more about electronics, would be nice to fix this other one, but there are not any obviously burnt or bulging components, so I wouldn't know what to look for next.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53479533%2fpython-pyserial-readline-not-working-but-screen-kinda-does-worked-in-ubuntu-16%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
For anybody that finds this thread. I had tried several different ways of getting output from the serial port, nothing was working. I was using our backup oximeter to test with. I switched out the oximeter for the one we normally use, and now serial communication is working properly. The bad oximeter appeared to be functioning correctly and displayed correctly on its screen, so I would not have guessed it might have been the device causing the problem with the serial communication.
Also oddly, turning the device off and on gets me some data out of the serial port, but only initially, I don't keep getting data. I almost gotta wonder if its just a setting or something weird with the device, but I looked the manual over and don't see anything. Wish I knew a little bit more about electronics, would be nice to fix this other one, but there are not any obviously burnt or bulging components, so I wouldn't know what to look for next.
add a comment |
For anybody that finds this thread. I had tried several different ways of getting output from the serial port, nothing was working. I was using our backup oximeter to test with. I switched out the oximeter for the one we normally use, and now serial communication is working properly. The bad oximeter appeared to be functioning correctly and displayed correctly on its screen, so I would not have guessed it might have been the device causing the problem with the serial communication.
Also oddly, turning the device off and on gets me some data out of the serial port, but only initially, I don't keep getting data. I almost gotta wonder if its just a setting or something weird with the device, but I looked the manual over and don't see anything. Wish I knew a little bit more about electronics, would be nice to fix this other one, but there are not any obviously burnt or bulging components, so I wouldn't know what to look for next.
add a comment |
For anybody that finds this thread. I had tried several different ways of getting output from the serial port, nothing was working. I was using our backup oximeter to test with. I switched out the oximeter for the one we normally use, and now serial communication is working properly. The bad oximeter appeared to be functioning correctly and displayed correctly on its screen, so I would not have guessed it might have been the device causing the problem with the serial communication.
Also oddly, turning the device off and on gets me some data out of the serial port, but only initially, I don't keep getting data. I almost gotta wonder if its just a setting or something weird with the device, but I looked the manual over and don't see anything. Wish I knew a little bit more about electronics, would be nice to fix this other one, but there are not any obviously burnt or bulging components, so I wouldn't know what to look for next.
For anybody that finds this thread. I had tried several different ways of getting output from the serial port, nothing was working. I was using our backup oximeter to test with. I switched out the oximeter for the one we normally use, and now serial communication is working properly. The bad oximeter appeared to be functioning correctly and displayed correctly on its screen, so I would not have guessed it might have been the device causing the problem with the serial communication.
Also oddly, turning the device off and on gets me some data out of the serial port, but only initially, I don't keep getting data. I almost gotta wonder if its just a setting or something weird with the device, but I looked the manual over and don't see anything. Wish I knew a little bit more about electronics, would be nice to fix this other one, but there are not any obviously burnt or bulging components, so I wouldn't know what to look for next.
answered Nov 27 '18 at 3:49
xekonxekon
5210
5210
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53479533%2fpython-pyserial-readline-not-working-but-screen-kinda-does-worked-in-ubuntu-16%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown