Hello Guest it is April 26, 2024, 05:00:01 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - moorea21

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 »
61
In a similar vein, should not this:-

If Dir ("C:\Users\r\Desktop\Gcode\",2,".cgf")<>"" Then
....

Give the same result as this:-

If Dir ("C:\Users\r\Desktop\Gcode\2.cgf")<>"" Then
....

I had hoped to replace the 2 with the expression "NextFileNum +1", and then increment NextFileNum on each loop to find and load/run the next file in a folder:-

If Dir ("C:\Users\r\Desktop\Gcode\",2,".cgf")<>"" Then
LoadRun ("C:\Users\r\Desktop\Gcode\", NextFileNum +1, ".cgf")

It hasn't worked...sorry to be so clueless, but how do I achieve this? I've looked through the cypress basic 'enduser' pdf, and not surprisingly there's nothing in there.

62
Thanks, I'll use Sleep.

In a macro, when I want to 'Code' a statement that ends with a variable, I've tried to use this syntax, but it complains about unexpected something or other.

Code "G28.1 X" ,X

What is the correct way to do this?

63
Thanks, couldn't spot that at all. There is also 'End If' missing after the longer Gcode section. After other changes, I'm left with pauses being ignored. Why is this? Searching 'macro G04 ignore' here hasn't turned up anything.

64
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

65
Thanks, that sounds simpler still.

66
That sounds good. It looks like I can also set another UserDRO to 1, and it can then be reset to 0 with a similar macro if Mach is reset, if I check 'Use init. on all resets', so hopefully both of these tasks should be do-able.

Is checking 'Use init on all resets' likely to have any unforeseen effects, if the initialisation string only contains the default string values, and a couple of calls to macros that reset the value of userDRO's or Vals? I don't want to find that this means something else won't work. Probably being over cautious now?

Thanks.

67
Although that appeared to be the case, I now find the following:-

It seems the value of Var is retained after Mach is shut down, but not when the PC itself is shut down, whereas UserDRO keeps its value in both cases.

I was hoping to set a variable to initialise at 0 any time Mach is started, and set to 1 after the first file has been loaded ( So another macro can tell if this is the first file loaded since Mach started up or not), but if both the above types retain their value after shutting down and restarting Mach, it won't work.

Is there a reliable way to clear the value of a Var or a UserDRO when Mach shuts down? Also, it would be useful to set up another 'flag' to show if reset has been pressed at any time since Mach was opened.

The macro (called from a Gcode test file) is this:-

Dim FirstFile As Double

FirstFile = GetVar(500)
Message FirstFile
If FirstFile <> 1 Then
   SetVar(500,1)
End If

68
I've tried both UserDro and Var ideas...

Var loses its value after Mach is shut down and restated, UserDro keeps its value.

Is this how it's supposed to work? Really didn't expect UserDro to keep its value...

69
Ok, ta. Manual wasnt too clear on params being read only.

70
That works a treat, Thanks.

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 »