here: crow

this is very interesting! am i correct in thinking that the commands one would send are just plain lua (the same as one might type in the druid REPL)? i’m guessing the system commands (as defined in the C source) would also work in this context?

1 Like

it’s just serial, so yes. there are no secrets.

7 Likes

Thank you so much for checking for me and providing such useful info. Same goes to @barksten. :heart:

3 Likes

I think I’m missing something, but I’m not sure what. After looking at the SerialPort docs, I came up with

(
p = SerialPort.new(
	"/dev/ttyACM0",
	baudrate: 115200
);
)

p.putAll("ii.jf.play_note(2,5)");

but this threw an error:

the error
ERROR: Primitive '_SerialPort_Open' failed.
caught exception 'open: The system cannot find the path specified' in primitive in method SerialPort:prOpen
RECEIVER:
Instance of SerialPort {    (00000262CC47A328, gc=5C, fmt=00, flg=00, set=02)
  instance variables [4]
    dataptr : nil
    semaphore : instance of Semaphore (00000262CC47A7F8, size=2, set=2)
    isOpen : false
    doneAction : nil
}
CALL STACK:
	MethodError:reportError
		arg this = <instance of PrimitiveFailedError>
	Nil:handleError
		arg this = nil
		arg error = <instance of PrimitiveFailedError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of PrimitiveFailedError>
	Object:throw
		arg this = <instance of PrimitiveFailedError>
	Object:primitiveFailed
		arg this = <instance of SerialPort>
	SerialPort:prInit
		arg this = <instance of SerialPort>
		arg args = [*8]
	< closed FunctionDef >  (no arguments or variables)
	Interpreter:interpretPrintCmdLine
		arg this = <instance of Interpreter>
		var res = nil
		var func = <instance of Function>
		var code = "(
p = SerialPort.new(
	"/dev..."
		var doc = nil
		var ideClass = <instance of Meta_ScIDE>
	Process:interpretPrintCmdLine
		arg this = <instance of Main>
^^ The preceding error dump is for ERROR: Primitive '_SerialPort_Open' failed.
caught exception 'open: The system cannot find the path specified' in primitive in method SerialPort:prOpen
RECEIVER: a SerialPort

the salient part seems to be The system cannot find the path specified. To double-check that crow was showing up as an available serial device, I ran SerialPort.devices;, and that returned an empty table. I tried power cycling my modular, thinking crow might be holding onto some memories of norns or druid, and that did change the situation somewhat. Running SerialPort.devices; after the power cycle returned one item in the table: COM3. I tried running the above code again, and it threw an error again, so I tried running a variation:

(
p = SerialPort(
	"COM3",
	baudrate: 115200
);
)

That didn’t throw an error! In fact, it returned a SerialPort. That seemed promising, so I tried sending a couple commands: p.putAll("ii.jf.mode(1)"); followed by p.putAll("ii.jf.play_note(4,5)");. That didn’t throw an error, but it also didn’t do anything.

Any idea what I might be doing wrong?

1 Like

the “/dev/“ formulation definitely won’t work on Windows, that might be one thing to look at

2 Likes