forked from harvie256/MaynuoPy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_speed_test_script.py
45 lines (36 loc) · 1.28 KB
/
update_speed_test_script.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#-------------------------------------------------------------------------------
# Name: update speed test script for Maynuo eload
# Generates a square wave to help testing the register write delay
# Purpose:
#
# Author: Derryn Harvie
#
# Created: 16/04/2014
# Licence: Public Domain
#-------------------------------------------------------------------------------
import Maynuo, time, sys
def main():
#----------------------------------------------------------
# This is the time delay after a register is written to the
# load, that the internal microcontroller has to process
# the write. 4ms is the shortest delay found to be reliable.
#----------------------------------------------------------
testRegisterWriteDelay = 0.004
highCurrent = 2.0
lowCurrent = 1.0
load = Maynuo.Maynuo(19,115200,1,testRegisterWriteDelay)
load.setCCurrent(lowCurrent)
load.setInputOn()
time.sleep(0.1)
print('System speed test')
currentHigh = False
for i in range(0,100):
if(currentHigh == False):
load.setCCurrent(lowCurrent)
currentHigh = True
else:
load.setCCurrent(highCurrent)
currentHigh = False
load.setInputOff()
if __name__ == '__main__':
main()