import firmware from firmward.boards.ramps import ramps_1_4 from firmware.motion import cartesian from firmware.display import ultralcd """ Create a new firmware object. Maybe this should be the arduino board and not the whole board, but they're usually synonymous """ fw = firmware(ramps_1_4) x_motor = ramps_1_4.get(ThingyType.Motor, 0) x_motor.invertDirection() x_motor.stepsPerMM(400) x_min_endstop = ramps_1_4.get(ThingyType.Endstop, 0) x_max_endstop = VirtualEndstop(200) # 200 mm away from x_min_endstop x_axis = Axis(x_motor, x_min_endstop, x_max_endstop); y_motor = ramps_1_4.get(ThingyType.Motor, 1) y_motor.invertDirection() y_motor.stepsPerMM(400) y_min_endstop = ramps_1_4.get(ThingyType.Endstop, 2) y_max_endstop = VirtualEndstop(200) # 200 mm away from y_min_endstop y_axis = Axis(y_motor, y_min_endstop, y_max_endstop); z_motor = ramps_1_4.get(ThingyType.Motor, 2) z_motor.stepsPerMM(2560) z_min_endstop = ramps_1_4.get(ThingyType.Endstop, 5) z_max_endstop = VirtualEndstop(200) # 200 mm away from y_min_endstop z_axis = Axis(z_motor, z_min_endstop, z_max_endstop); e_motor = ramps_1_4.get(ThingyType.Motor, 3); e_motor.stepsPerMM(768) # I'm a bit worried about including the e_motor in the cartesian object # because of changing API with dual extruders, but this is just a demo so... frame = cartesian(x_motor, y_motor, z_motor, e_motor) fw.use(frame).use(ultralcd) fw.write('firmware.hex');
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question