I've written this, to interact with a picaxe and a light sensor that works like this:-
- Outputs are activated, one 5.0V for the picaxe and sensor, etc, the other 3.6V for an LED.
- The picaxe gives a signal to the BOB to say it's switched on
-The picaxe via sensor measures ambient light through a small 'window', records its value
-The machine (Mach3) squirts a sample of paint on the window and compares the amount of light before and afterwards; if the difference is over a certain value, IsSquirtBigEnough sets to 1, and the macro ends, returning focus to the Gcode file that called it
-If the paint deposit was not big enough, IsSquirtBigEnough sets to 0, and the macro returns to the label 'tryagain'. The window self cleans (C drive), and the test starts again
Code attached; there may well be a better way for Mach to look out for signals from external sources, also my gcode pauses may not produce accurate timing as they are probably slow to process. That's my guess anyway.
This code gives me a syntax error, without highlighting where that error is, and I haven't been able to spot it. The missing 'Is' from the start of a variable name isnt it; I fixed that, same result.
Also, my method for coordinating the actions of main machine and picaxe may not be that good; has anyone successfully used somethng like this before? If so, how was it coded to make sure both units work together in time?
Thanks
M21