| Reply | « Previous Thread | Next Thread » |
|
Hi,
I am trying to use Python to connect to Nonin's 4100 OEM bluetooth pulse oximeter (to measure heart rate). The datasheet is here: http://www.nonin.com/documents/4100%...ifications.pdf Right now, I am trying to modify this program (below) to work with the sensor. When I connect however, the program just print reading... and then does nothing. For now, I would be happy if I could just get anything from the sensor, but I eventually want to be able to get the heart rate. According to Nonin, the heart rate can be found using: HR = HRMSB * 128 + HRLSB. So... if I could get the HRMSB and HRLSB from the sensor, I would be quite happy ![]() And here is the sorta not maybe half working code Code:
import appuifw, socket, e32
target = ''
target = ('00:a0:96:17:d6:fc',1)
def connectGPS():
global sock, target
# create a bluetooth socket and connect to GPS receiver: (if it is a Nokia LD-3W the PIN is: 0000)
#try:
sock=socket.socket(socket.AF_BT,socket.SOCK_STREAM)
if target == '':
address,services = socket.bt_discover()
print "Discovered: %s, %s"%(address, services)
target = (address, services.values()[0])
print "Connecting to " + str(target)
sock.connect(target)
appuifw.note(u"Pulse Oximeter successfully connected!", "info"
print "connected!"
readData()
#except:
# if appuifw.query(u"Device problem. Connect again?","query") == True:
# sock.close()
# connectGPS()
# else:
# sock.close()
def readData():
global sock
packet_received = 0
print "reading ..."
while(0 == 0):
ch = sock.recv(1)
print str(ch)
# Loop until packet received
buffer = ""
while(1==1):
buffer+=ch
ch = sock.recv(1)
print str(ch)
print str(buffer)
if (buffer[0:1]!=""):
gpsData = buffer.split(",")
lat = gpsData[2]
lon = gpsData[4]
if lat == '' :
pass
else:
packet_received = 1
appuifw.note(u'Sucessful GPS location reading! ' + unicode(lat) + u' ' + unicode(lon), "info")
print "reading done!"
print "Press Options key!"
sock.close()
else:
pass
def exit_key_handler():
script_lock.signal()
sock.close()
script_lock = e32.Ao_lock()
print "Press Options key!"
appuifw.app.title = u"BT GPS reader"
appuifw.app.menu = [(u"get GPS location", connectGPS)]
appuifw.app.exit_key_handler = exit_key_handler
script_lock.wait()
![]() PS: I'm using the Nokia N80 with Symbian 3rd edition |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Please help installing Python libraries on S60 | ericroijen | Python | 11 | 2009-07-18 11:43 |
| Connecting With Bluetooth to a Nonin Medical Sensor | icinnamon | Python | 4 | 2008-07-31 01:15 |
| Read serial data into N80 via Bluetooth python script | romotrp | Bluetooth Technology | 2 | 2007-05-12 09:52 |
| how to run bluetooth socket programming in python in nokia 6681 | mohib | Python | 1 | 2006-09-20 00:41 |
| [announce] PyBluez 0.7 - Bluetooth extensions for Python | relbs | Python | 0 | 2006-05-13 05:07 |