Logging Arduino data on computer via serial port

Status
Not open for further replies.

ben7

Member
I have a project where I need to log data on a file on a computer, which is connected to an arduino, which will read sensors.

I played around with reading the serial port using python. The Arduino just does a loop where it increments a variable by one, and prints the variables' value to the serial port. But, when I read the data from the port in python, the data I get is old(from before the python program even started). Also, when I start the python program again, it starts with the old data (i.e. 1,2,3,4...). Python has no built-in way to read serial ports, so I installed PySerial[URL].

How do I get the latest data that is printed to the serial port?

Also, could someone clarify how the serial ports work?

Thanks,
Ben
 
Hard to debug code without seeing it.
Yeah I know sorry, but I have had a change of plan. The main program is on the computer, and it periodically tells the arduino to send back certain data, and it does so. Its going along much better this time
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…