Created
November 9, 2012 21:43
-
-
Save randallagordon/4048447 to your computer and use it in GitHub Desktop.
Controlling a ShapeOko using a cup of Coffee creamed with Zappa goodness!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
serialport = require "serialport" | |
port = "/dev/ttyACM0" # your ShapeOko's port here | |
oko = new serialport.SerialPort port, { | |
baudrate: 9600, | |
parser: serialport.parsers.readline "\n" | |
} | |
G = (g) -> | |
oko.write g + "\n" | |
return g | |
require('zappajs') -> | |
@get '/a': -> G "G90" | |
@get '/i': -> G "G91" | |
@get '/G1/:feed/:axis/:distance': -> | |
G "G1 F#{@params.feed} #{@params.axis} #{@params.distance}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change the port to the path of your Grbl or other G code consuming serial device and then make sure the serialport and zappajs packages are installed:
The following request will send a G91 to switch to incremental positioning:
Then go nuts sending G1s via requests like:
Obviously isn't robust in any way, shape or form—but, gives me a way to position my ShapeOko via teh interwebs.