-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.py
64 lines (49 loc) · 1.46 KB
/
upload.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import pyboard
import time
import os
def uploadFile(src, dest=None):
time_start = time.time()
if dest:
print('upload: {0} ---------> {1} '.format(src, dest), end='')
pyb.fs_put(src, dest)
else:
print('upload: {0} ---------> {0} '.format(src), end='')
pyb.fs_put(src, src)
time_end = time.time()
print('finish in {0} s'.format(time_end - time_start))
def uploadFolder(folderPath, folderDest=None):
for filename in os.listdir(folderPath):
if folderDest:
src = folderPath + filename
dest = folderDest + filename
uploadFile(src, dest)
else:
src = folderPath + filename
uploadFile(src)
if __name__ == '__main__':
com = 'COM13'
print('\033[1m')
pyb = pyboard.Pyboard(com)
pyb.enter_raw_repl()
# pyb.fs_mkdir('py')
print('\npy Folder')
pyb.fs_ls('py')
print('\nALL file')
pyb.fs_ls('/')
print('\nFLASH file')
pyb.fs_ls('/flash')
print('\n')
# pyb.fs_cat('main.py')
# pyb.fs_rm('config.json')
os.chdir('main')
# uploadFile('boot.py')
uploadFile('main.py')
os.chdir('py')
# uploadFile('us100.py', 'py/us100.py')
# uploadFile('hx711.py', 'py/hx711.py')
# uploadFile('scales.py', 'py/scales.py')
# uploadFile('ws2812.py', 'py/ws2812.py')
# uploadFile('berry.py', 'py/berry.py')
uploadFile('motor.py', 'py/motor.py')
pyb.exit_raw_repl()
pyb.close()