- Posts: 1004
- Thank you received: 449
Bash M1## how to use the P word
- my1987toyota
- Offline
- Platinum Member
-
Less
More
5 years 1 month ago #220366
by my1987toyota
Bash M1## how to use the P word was created by my1987toyota
So I have been trying to write an M1## code and using the P word to determine which instruction
to follow. I have written M1## codes to facilitate what feeder to trigger in combination with ClassicLadder.
The current code uses the " #!/bin/bash " and the " case " command.
if I put in the " echo " command before each halcmd . and it will list the commands when I run it in terminal.
but if I remove the " echo " command and run it in linuxcnc it wont send anything to linuxcnc but no error messages
appear either .
I am by no means any kind of expert in bash scripting and I hope I am missing something simple .
So I am looking for some idea what to look into here .
to follow. I have written M1## codes to facilitate what feeder to trigger in combination with ClassicLadder.
The current code uses the " #!/bin/bash " and the " case " command.
if I put in the " echo " command before each halcmd . and it will list the commands when I run it in terminal.
but if I remove the " echo " command and run it in linuxcnc it wont send anything to linuxcnc but no error messages
appear either .
I am by no means any kind of expert in bash scripting and I hope I am missing something simple .
So I am looking for some idea what to look into here .
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
-
Less
More
- Posts: 7368
- Thank you received: 2181
5 years 1 month ago #220402
by cmorley
Replied by cmorley on topic Bash M1## how to use the P word
Did you make it executable?
Does the file name use a lower case M?
Does the file name use a lower case M?
The following user(s) said Thank You: my1987toyota
Please Log in or Create an account to join the conversation.
- my1987toyota
- Offline
- Platinum Member
-
Less
More
- Posts: 1004
- Thank you received: 449
5 years 1 month ago #220413
by my1987toyota
The file uses an upper case M.
Replied by my1987toyota on topic Bash M1## how to use the P word
I will double check on the executable part .cmorley post=220402 userid=482Did you make it executable?
Does the file name use a lower case M?
The file uses an upper case M.
Please Log in or Create an account to join the conversation.
- anfänger
- Offline
- Platinum Member
-
Less
More
- Posts: 647
- Thank you received: 267
5 years 1 month ago #220418
by anfänger
Replied by anfänger on topic Bash M1## how to use the P word
Upper case works for me. Usually it‘s the executable part. And it need to be in the right folder. And executable and in the folder before LinuxCNC starts. But then it works fine
The following user(s) said Thank You: my1987toyota
Please Log in or Create an account to join the conversation.
- my1987toyota
- Offline
- Platinum Member
-
Less
More
- Posts: 1004
- Thank you received: 449
5 years 1 month ago #220503
by my1987toyota
Replied by my1987toyota on topic Bash M1## how to use the P word
I am sure it will come down to my usual problem of inexperience .
I am still very new to coding C, C++, Python , Bash ect. I wish
their were more examples of Bash in Linuxcnc to draw from.
I think my problem stems from the fact that I am not sending a number to
a command I am using the P number to select a " case "
and that determines what part of the M code to run. That in turn
tells ClassicLadder what input and output pins to actuate .
I am still very new to coding C, C++, Python , Bash ect. I wish
their were more examples of Bash in Linuxcnc to draw from.
I think my problem stems from the fact that I am not sending a number to
a command I am using the P number to select a " case "
and that determines what part of the M code to run. That in turn
tells ClassicLadder what input and output pins to actuate .
Please Log in or Create an account to join the conversation.
- MaHa
- Offline
- Platinum Member
-
Less
More
- Posts: 542
- Thank you received: 241
5 years 1 month ago #220505
by MaHa
Replied by MaHa on topic Bash M1## how to use the P word
eg. for case 100 i was successful with
Code:
case $1 in
100.000000)
Please Log in or Create an account to join the conversation.
Time to create page: 0.153 seconds