Add pauses

This commit is contained in:
Panda 2024-12-23 13:40:25 +01:00 committed by Thomas Lindner
parent 2e3da420a6
commit b952810e7a
2 changed files with 65 additions and 65 deletions

View file

@ -16,10 +16,10 @@ with open("FREUDE.gcode", "w") as f:
f.write("G4 S2\n")
position = 0
with open("freude.txt", "r") as notes:
for note, duration in csv.reader(notes):
for note, duration, pause in csv.reader(notes):
feedrate = int(frequencies[int(note) + 12] * 60 / steps_per_mm)
length = int(duration) * base_duration / 60 * feedrate
position += -length if position > 100 else length
f.write(f"G0 X{position:.6f} Y{position:.6f} F{feedrate} \n")
f.write("G4\n")
f.write(f"G0 X{position:.6f} Y{position:.6f} F{feedrate}\n")
f.write(f"G4 P{int(int(pause) * base_duration)}\n")
f.write("G4 S2\n")

View file

@ -1,62 +1,62 @@
4,2
4,2
5,2
7,2
7,2
5,2
4,2
2,2
0,2
0,2
2,2
4,2
4,3
2,1
2,4
4,2
4,2
5,2
7,2
7,2
5,2
4,2
2,2
0,2
0,2
2,2
4,2
2,3
0,1
0,4
2,2
2,2
4,2
0,2
2,2
4,1
5,1
4,2
0,2
2,2
4,1
5,1
4,2
2,2
0,2
2,2
-5,4
4,2
4,2
5,2
7,2
7,2
5,2
4,2
2,2
0,2
0,2
2,2
4,2
2,3
0,1
0,4
4,2,0
4,2,0
5,2,0
7,2,0
7,2,0
5,2,0
4,2,0
2,2,0
0,2,0
0,2,0
2,2,0
4,2,0
4,3,0
2,1,0
2,4,0
4,2,0
4,2,0
5,2,0
7,2,0
7,2,0
5,2,0
4,2,0
2,2,0
0,2,0
0,2,0
2,2,0
4,2,0
2,3,0
0,1,0
0,4,0
2,2,0
2,2,0
4,2,0
0,2,0
2,2,0
4,1,0
5,1,0
4,2,0
0,2,0
2,2,0
4,1,0
5,1,0
4,2,0
2,2,0
0,2,0
2,2,0
-5,4,0
4,2,0
4,2,0
5,2,0
7,2,0
7,2,0
5,2,0
4,2,0
2,2,0
0,2,0
0,2,0
2,2,0
4,2,0
2,3,0
0,1,0
0,4,0