-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprogrammer.py~
More file actions
39 lines (31 loc) · 803 Bytes
/
programmer.py~
File metadata and controls
39 lines (31 loc) · 803 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
33
34
35
36
37
38
39
'''
AT28C16 Bin Loader
October 22, 2020 - Patrick Jackson
Use this program to upload your .bin files
to the AT28C16 eeprom. Needs the complementary
Arduino Nano firmware to work.
Syntax:
programmer.py [COM] [e/r/p] [\..\file.bin]
'''
import serial, sys, getopt, time
def main(argv):
# open serial port
try:
ser = serial.Serial(sys.argv[1], 9600)
except:
print("COM device not accessable.")
# open bin file
if sys.argv[2] == 'p':
try:
f = open(sys.argv[3], "rb")
except:
print(sys.argv[3] + " does not exist.")
# check for erase/read
if sys.argv[2] == 'e':
ser.write(ascii('e'))
while True:
bytesToRead = ser.inWaiting()
byte = ser.read(bytesToRead)
print(byte)
if __name__ == "__main__":
main(sys.argv[1:])