-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisplay.py
More file actions
32 lines (21 loc) · 688 Bytes
/
Copy pathDisplay.py
File metadata and controls
32 lines (21 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import serial as ser
COM_PORT = 4 # COM 5
BAUD_RATE = 115200
TIMEOUT = 1
class Display:
def __init__(self):
self.serial = ser.Serial()
self.serial.baudrate = BAUD_RATE
self.serial.port = COM_PORT
self.serial.timeout = TIMEOUT
self.serial.open()
self.vals = [[150, 140, 130], [120, 114, 106], [100, 90, 80], [75, 64, 60], [50, 45, 40]]
def move(self, sect, section):
msg = r'' + 'n' + str(self.vals[sect][section]) + '\r'
self.serial.write(msg)
def move_osc(self, sect, section):
msg = r'' + 'o' + str(self.vals[sect][section]) + '\r'
self.serial.write(msg)
def base(self):
base_angle = r'' + 'n' + '150' + '\r'
self.serial.write(base_angle);