Here’s my suggestion using ChiliPeppr. One of the design goals was to let you bind into multiple serial ports at the same time from CP so you could sync your CNC commands with other hardware (thus a hardware fiddle). So, I would setup an Arduino that reads your sensor on your spindle. Then write a tiny bit of code that just spits out the sensor position every 250ms or perhaps when you request it. Then write a macro in CP that binds into the serial port with your sensor.
chilipeppr.subscribe("/com-chilipeppr-widget-serialport/ws/recv", function(data) {
if (data.P == "COM4") {
// this is data from my Arduino sensor
if (data.D.match(/1000/)) {
// I'm at 1000rpm, now move Z into aluminum
chilipeppr.publish("/com-chilipeppr-widget-serialport/send", "G1 Z-2 F100\n");
}
}
});
-
This reply was modified 10 years, 3 months ago by jlauer.