pyserial

Reading data from serial port (COM3) using pyserial module on Windows XP

北战南征 提交于 2019-12-11 11:59:57
问题 Before going into the problem, here is some hardware/software information: Device accessed: Ohaus Scout Pro Digital Weight Machine (product link) Interface used: USB (product link) Serial Port: COM3 OS: WinXP Python Version: Activestate Python 2.7 pyserial version: 2.5 Python recognized this serial port and had no problems opening it. I am new to python as well as pyserial. I couldn't figure out how exactly can I read data from the serial port. I used the following code: 1 import serial 2 ser

Python ImportError: No module named serial

吃可爱长大的小学妹 提交于 2019-12-11 10:41:31
问题 I have installed Python 2.7.5 on Ubuntu 12.4 on a DELL LATITUDE E4300 64 bit and ran: sudo pip install pyserial nevertheless when running: sudo python main.py I receive the following error message: Traceback (most recent call last): File "main.py", line 4, in <module> from mySerial import * File "/home/oscar/ath10k/tools/sanity_test/src/mySerial.py", line 6, in <module> import serial ImportError: No module named serial I looked on other posts but none of them helped me to solve this problem.

live plotting using pyserial and matplotlib

青春壹個敷衍的年華 提交于 2019-12-11 10:23:22
问题 I can capture data from serial device via pyserial, at this time I can only export data to text file, the text file has format like below, it's have 3 columns >21 21 0 > >41 41 0.5 > >73 73 1 > .... >2053 2053 5 > >2084 2084 5.5 > >2125 2125 6 Now I want to use matplotlib to generate live graph has 2 figure (x,y) x,y are second and third column, first comlumn,'>', and lines don't have data can be remove thank folks! ============================ Update : today, after follow these guides from

Serial Communication one to one

天大地大妈咪最大 提交于 2019-12-11 08:55:40
问题 If this is a stupid question, please don't mind me. But I spent some time trying to find the answer but I couldn't get anything solid. Maybe this is a hardware question, but I figured I'd try here first. Does Serial Communication only work one to one? The reason this came up is because I had an arduino board listening for communication on its serial port. I had a python script feed bytes to the port as well. However, whenever I opened up the arduino's serial monitor, the connection with the

Python no module named serial / no module named requests

我的未来我决定 提交于 2019-12-11 08:17:37
问题 This is the second time today this has happened.. I tried to import requests earlier and I got an Import Error: no module named requests Same thing for serial I googled the crap out of this and nothing I've found works. Any ideas as to what's going on? I'm trying to use pyserial to take input from an arduino 回答1: pip install requests pip install pyserial should do it (unless you don't have pip installed) 回答2: are you looking for urllib.requests? if you are using python 2.7 when you ask for

Embedding matplotlibAnimation

﹥>﹥吖頭↗ 提交于 2019-12-11 08:07:59
问题 I am designing an app that must plot a serial from a sensor through Arduino and Python. I am using matplotlib to animate my graph, and it works fine with the code that can be seen in a question I posted yesterday: Arduino Live Serial Plotting with a MatplotlibAnimation gets slow. Now, since I want to make a nice looking GUI, I want to embed my animation in PyQt5. For that I've taken as a reference this link https://pythonspot.com/en/pyqt5-matplotlib/ together with that one Getting blitting to

Multiprocessing code bug

◇◆丶佛笑我妖孽 提交于 2019-12-11 06:26:36
问题 I want to read/write data from Serial port and record video simultaneously. For this task I am using multiprocessing module in Python. I wrote the following code as a test which runs fine when I run it in a separate script i.e. it records a video and writes to a file. video_length = 10 time_stamp = datetime.now().strftime("%d-%m-%y-%H-%M-%S.%f")[:-3] i= 5 for i in range(10): if i == 5: # Simulate an imaginary condition if __name__ == '__main__': P1 = Process(target = Record_Video, args =

Arduino Sketch works with Serial Monitor but not with pyserial

流过昼夜 提交于 2019-12-11 06:17:34
问题 I am testing this simple arduino code in python but it works in arduino serial not in python. User defines the number of blinks on the led. This works on arduino serial monitor. But when I use it in python it does not work. can anyone help? Thank you Arduino code: int ledPin = 13; // select the pin for the LED int val = 0; // variable to store the data from the serial port void setup() { pinMode(ledPin,OUTPUT); // declare the LED's pin as output Serial.begin(9600); while (!Serial) { ; // wait

Python check input from console and serial at the same time?

孤人 提交于 2019-12-11 06:16:34
问题 I am writing a python application that reads the user input (from the console) : buff = raw_input('Enter code: ') and generates and output based on a series of algorithms. The problem I have is that the application is also connected via serial to another machine that sets some state configuration attributes. To read a string from the serial (COM) port I'm using the PySerial library: ser = serial.Serial('/dev/ttyAMA0') ser.baudrate = 115200 [...] if not(ser.isOpen()): ser.open() s = ser

Receive multiple values via pyserial and display in Python GUI

好久不见. 提交于 2019-12-11 05:21:39
问题 I am trying to receive data using serial communication in Python, which I can do, but I need to improve my code. I am sending a "packet" from Arduino that is in the form of "&4,25/n" with the key factors being the values in the positions of "4" and "25". In this packet, I have the "&" as a startbyte, and the new line feed "/n" as a terminator. This is so that I can tell when a new packet is sent, and it ends. How can I receive this packet "&4,24/n" and extract the values that are in the