python

Discussion in 'Electronics Resources' started by flem su, Apr 11, 2011.

  1. flem su

    Thread Starter New Member

    Apr 1, 2011
    5
    0
    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.
     
  2. someonesdad

    Senior Member

    Jul 7, 2009
    1,585
    141
    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.
     
    flem su likes this.
  3. flem su

    Thread Starter New Member

    Apr 1, 2011
    5
    0
    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
     
  4. flem su

    Thread Starter New Member

    Apr 1, 2011
    5
    0
    and do you maybe have a link where I download "Python Essential Reference"
     
  5. someonesdad

    Senior Member

    Jul 7, 2009
    1,585
    141
    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.
     
  6. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
    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
     
Loading...