Hello Guest it is April 16, 2024, 03:44:06 PM

Author Topic: Trying to write a simple function need help  (Read 1543 times)

0 Members and 1 Guest are viewing this topic.

Re: Trying to write a simple function need help
« Reply #10 on: March 25, 2020, 03:01:37 AM »
Hi,
to start with put
Code: [Select]
local inst = mc.mcGetInstance() inside the function otherwise 'inst' is out of scope.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline DAAD

*
  •  103 103
    • View Profile
Re: Trying to write a simple function need help
« Reply #11 on: March 25, 2020, 03:38:37 AM »
thanks for the basics tip!

Offline DAAD

*
  •  103 103
    • View Profile
Re: Trying to write a simple function need help
« Reply #12 on: March 25, 2020, 04:31:07 PM »
If you look at the Axis Mapping in the Mach4 control config you can get an idea of what child ID could be. I'm thinking it could be the position of master/slave boxes for each motor. So X axis master you would use 0 for the axis and 0 for child ID. To get the slave 1 motor id for the X axis you would use 0 for the axis and 1 for the child ID.

Are you trying to get the axis ID or the motor ID?

There is also this function from the API:
Code: [Select]
axisId, rc = mc.mcMotorGetAxis(number mInst, number motorId)


Searched inside the ini file and foud the following info:

Axis 3 = Child ID0 = Motor 4, Child ID1 = No motor found.  So your info seems correct. If i want the value of the motor in need 0 in the child ID.

still don't get the function working tho...
do i need to do something special for the number to return?