python

Thread Starter

flem su

Joined Apr 1, 2011
5
Does anyone have a python code that counts the when a square wave goes high that i send in through com port. Don't know if it makes sense. The frequency is not constant though. Or maybe just a manual which will help me learn basic python coding.
 

someonesdad

Joined Jul 7, 2009
1,583
You'll have to explain your problem in much more detail. What do you mean by a "square wave on the com port"? Do you mean a COM port (as in an RS-232 port on a PC) or a communications port?

There are many books to learn python from, but I still think one of the best (especially if you're an experienced C programmer) is the tutorial that comes with python.

If you're an experienced programmer with a number of languages under your belt, one of the best and shortest introductions to python is in the first edition of Beazley's book "Python Essential Reference". Later versions morphed into double or triple the thickness, but I still stick with the first edition. It's superb.
 

Thread Starter

flem su

Joined Apr 1, 2011
5
I'm importing a heart rate signal form a circuit through RS-232 port. The final comes from a comparator. It goes to 5V every time a pulse is detected. I want count these pulses an get an average in python
 

someonesdad

Joined Jul 7, 2009
1,583
I've used python to talk to the serial port with two python libraries: pyserial and pyvisa. I don't understand how you're doing things with the serial port, so I'll leave you to figure that out. The two libraries typically use the ctypes python library to talk to the platform's DLLs to connect to the serial port. The nice thing is that they try to abstract away the platform details.

The book can be purchased; I would bet that if you can download it somewhere, it's an illegal copy.
 

bertus

Joined Apr 5, 2008
22,278
Hello,

Please do NOT requests on the downloads of copyrighted material.
If you continue with it it will result in a ban.
If you want it, go to a library or buy it.

Bertus
 
Top