Hi everyone,
I’m using the MpCnc3Axis function to control three axes with G-code, but I need to ensure the Z-axis doesn’t collide with obstacles. To address this, I’m integrating an inductive sensor with an analog input to set a safe offset range for the Z-axis.
However, I’m encountering an issue: when I use the analog input for the Z-axis, the value isn’t updated in real-time. Instead, it retains the last sensor reading before the G-code line executes. This makes it difficult to accurately control the Z-axis in real-time, increasing the risk of collisions.
For example, when I use the code G01 X10 Y10 Z=AnalogInput, where ‘AnalogInput’ is a variable linked to the inductive sensor, the command moves to X10 Y10 and Z[last number] based on the last sensor value at the time of code execution. This doesn’t reflect real-time changes in sensor readings.
I’m looking for advice on how to program G-code so that the Z-axis adjusts continuously based on the latest analog sensor readings, allowing for real-time adjustments. Any suggestions on achieving real-time updates for this axis would be greatly appreciated.