repo time
Dependencies: mbed MAX14720 MAX30205 USBDevice
HspGuiSourceV301/Script/hsp_intassignment.py@20:6d2af70c92ab, 2021-04-06 (annotated)
- Committer:
- darienf
- Date:
- Tue Apr 06 06:41:40 2021 +0000
- Revision:
- 20:6d2af70c92ab
another repo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
darienf | 20:6d2af70c92ab | 1 | import serial |
darienf | 20:6d2af70c92ab | 2 | import io |
darienf | 20:6d2af70c92ab | 3 | import time |
darienf | 20:6d2af70c92ab | 4 | |
darienf | 20:6d2af70c92ab | 5 | ser = serial.Serial(port='com16', baudrate=9600, timeout=1) |
darienf | 20:6d2af70c92ab | 6 | |
darienf | 20:6d2af70c92ab | 7 | ser.isOpen() |
darienf | 20:6d2af70c92ab | 8 | |
darienf | 20:6d2af70c92ab | 9 | ser.write("/MAX30001/WriteReg 2 3\r\n".encode()) |
darienf | 20:6d2af70c92ab | 10 | print(ser.readline()) |
darienf | 20:6d2af70c92ab | 11 | ser.write("/MAX30001/WriteReg 3 3\r\n".encode()) |
darienf | 20:6d2af70c92ab | 12 | print(ser.readline()) |
darienf | 20:6d2af70c92ab | 13 | |
darienf | 20:6d2af70c92ab | 14 | |
darienf | 20:6d2af70c92ab | 15 | #time.sleep(5) |
darienf | 20:6d2af70c92ab | 16 | #for x in range (0, 100): |
darienf | 20:6d2af70c92ab | 17 | ser.write("/MAX30001/INT_assignment 1 0 0 2 1 0 2 2 0 1 0 0 2 1 0 3 3\r\n".encode()) |
darienf | 20:6d2af70c92ab | 18 | print(ser.readline()) |
darienf | 20:6d2af70c92ab | 19 | |
darienf | 20:6d2af70c92ab | 20 | ser.write("/MAX30001/WriteReg 10 080004\r\n".encode()) |
darienf | 20:6d2af70c92ab | 21 | print(ser.readline()) |
darienf | 20:6d2af70c92ab | 22 | |
darienf | 20:6d2af70c92ab | 23 | ser.write("/MAX30001/ReadReg 2\r\n".encode()) |
darienf | 20:6d2af70c92ab | 24 | print(ser.readline()) |
darienf | 20:6d2af70c92ab | 25 | ser.write("/MAX30001/ReadReg 3\r\n".encode()) |
darienf | 20:6d2af70c92ab | 26 | print(ser.readline()) |
darienf | 20:6d2af70c92ab | 27 | |
darienf | 20:6d2af70c92ab | 28 | ser.close() |