This is the latest working repository used in our demo video for the Maxim to display temperature readings on Bluetooth
hspguisourcev301/HspGuiSourceV301/Script/hsp_intassignment.py@5:bc128a16232f, 2021-05-02 (annotated)
- Committer:
- darienf
- Date:
- Sun May 02 23:09:04 2021 +0000
- Revision:
- 5:bc128a16232f
- Parent:
- 3:36de8b9e4b1a
This is the program that was last used, that has the working temperature and some comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
darienf | 3:36de8b9e4b1a | 1 | import serial |
darienf | 3:36de8b9e4b1a | 2 | import io |
darienf | 3:36de8b9e4b1a | 3 | import time |
darienf | 3:36de8b9e4b1a | 4 | |
darienf | 3:36de8b9e4b1a | 5 | ser = serial.Serial(port='com16', baudrate=9600, timeout=1) |
darienf | 3:36de8b9e4b1a | 6 | |
darienf | 3:36de8b9e4b1a | 7 | ser.isOpen() |
darienf | 3:36de8b9e4b1a | 8 | |
darienf | 3:36de8b9e4b1a | 9 | ser.write("/MAX30001/WriteReg 2 3\r\n".encode()) |
darienf | 3:36de8b9e4b1a | 10 | print(ser.readline()) |
darienf | 3:36de8b9e4b1a | 11 | ser.write("/MAX30001/WriteReg 3 3\r\n".encode()) |
darienf | 3:36de8b9e4b1a | 12 | print(ser.readline()) |
darienf | 3:36de8b9e4b1a | 13 | |
darienf | 3:36de8b9e4b1a | 14 | |
darienf | 3:36de8b9e4b1a | 15 | #time.sleep(5) |
darienf | 3:36de8b9e4b1a | 16 | #for x in range (0, 100): |
darienf | 3:36de8b9e4b1a | 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 | 3:36de8b9e4b1a | 18 | print(ser.readline()) |
darienf | 3:36de8b9e4b1a | 19 | |
darienf | 3:36de8b9e4b1a | 20 | ser.write("/MAX30001/WriteReg 10 080004\r\n".encode()) |
darienf | 3:36de8b9e4b1a | 21 | print(ser.readline()) |
darienf | 3:36de8b9e4b1a | 22 | |
darienf | 3:36de8b9e4b1a | 23 | ser.write("/MAX30001/ReadReg 2\r\n".encode()) |
darienf | 3:36de8b9e4b1a | 24 | print(ser.readline()) |
darienf | 3:36de8b9e4b1a | 25 | ser.write("/MAX30001/ReadReg 3\r\n".encode()) |
darienf | 3:36de8b9e4b1a | 26 | print(ser.readline()) |
darienf | 3:36de8b9e4b1a | 27 | |
darienf | 3:36de8b9e4b1a | 28 | ser.close() |