forked from JorgeMaker/SimpleFOCStudio
-
Notifications
You must be signed in to change notification settings - Fork 14
/
scriptTest.py
24 lines (23 loc) · 946 Bytes
/
scriptTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from src.simpleFOCConnector import SimpleFOCDevice
import time
if __name__ == '__main__':
deviceConnector = SimpleFOCDevice.getInstance()
deviceConnector.serialPortName = 'COM32'
deviceConnector.serialRate = 115200
deviceConnector.devCommandID = 'M'
if deviceConnector.connect(SimpleFOCDevice.ONLY_CONNECT):
while True:
deviceConnector.sendControlType(SimpleFOCDevice.ANGLE_CONTROL)
deviceConnector.sendTargetValue(0)
time.sleep(2.0)
deviceConnector.sendTargetValue(3)
time.sleep(2)
deviceConnector.sendTargetValue(6)
time.sleep(2)
deviceConnector.sendTargetValue(-6)
time.sleep(2)
deviceConnector.sendControlType(SimpleFOCDevice.VELOCITY_CONTROL)
deviceConnector.sendTargetValue(30)
time.sleep(2)
deviceConnector.sendTargetValue(-30)
time.sleep(2)