Gcodedriver Arduino

264 views
Skip to first unread message

jason Lee

unread,
May 23, 2016, 8:42:35 PM5/23/16
to OpenPnP
Hi Jason,

Could you please explain a little bit more how to config the machine.xml in order to use an Arduino board? Say, I just want to turn a LED on and off by set a pin on the Arduino to "high" or "low".

Should I set it up in the sub-driver? It seems like the example sub-driver is still about linear motion. How should I set up another serial communication?

<sub-drivers class="java.util.ArrayList">
<reference-driver class="org.openpnp.machine.reference.driver.GcodeDriver" port-name="/dev/tty.usbmodem1A12421" baud="9600" units="Millimeters" max-feed-rate="50000" connect-wait-time-milliseconds="750">
<home-location units="Millimeters" x="0.0" y="0.0" z="0.0" rotation="0.0"/>
<command-confirm-regex>^ok.*</command-confirm-regex>
<actuate-double-command>{Index}</actuate-double-command>
<sub-drivers class="java.util.ArrayList"/>
</reference-driver>
</sub-drivers>

Thank you!

Jason

Jason von Nieda

unread,
May 24, 2016, 10:05:48 PM5/24/16
to OpenPnP
Hi Jason,

At the very bottom of https://github.com/openpnp/openpnp/wiki/GcodeDriver there is a sample Arduino sketch and machine.xml that shows how to do exactly this. 

The "sub-driver" does have some linear motion stuff in it, but it can be ignored. Those are just default variables present in every instance of the GcodeDriver. The real work is being done by the <actuate-double-command>{Index}</actuate-double-command> line. This line tells OpenPnP that when an actuator fires it's actuate(double) command it will send just the index of the actuator to the serial port. The Arduino sketch is watching for an index and sets the corresponding LED.

If it's still not clear, let me know a little bit more about what you want to do and I will try to help. Specifically, I need to know if you are trying to use an Arduino in addition to your motion controller, and how you want to trigger it. 

Jason
--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/0ad462ef-0ca0-4cfa-a72f-8c88341d2a69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jason Lee

unread,
May 25, 2016, 7:59:59 PM5/25/16
to OpenPnP
Thanks a bunch for the information!
Reply all
Reply to author
Forward
0 new messages