[solved] Need help with GcodeCNCDemo
Shop › Forum › Everything Else › [solved] Need help with GcodeCNCDemo
- This topic is empty.
-
AuthorPosts
-
2014-09-07 at 17:09 #6032AnonymousInactive
Hello,
I tried the help given in the July post but I still have trouble. I’m using Arduino 1.5.7. I have motor shield version 1.2. I’ve posted as Richard on the blog. I’m hoping to use this with a XY table and a servo to lift a tool.With trying version 1 of the 2 axis software it will not parse the numbers correctly. I type in M114; and I display val inside parsenumber function it outputs -1.0.
With trying version 2 of the 2 axis software, when I change to #define MOTOR_SHIELD_VERSION (1) I get;
GcodeCNCDemo2AxisV2.ino: In function ‘void setup()’:
GcodeCNCDemo2AxisV2.ino:322:3: error: ‘AFMS’ was not declared in this scopeWhen I leave on
#define MOTOR_SHIELD_VERSION (2) // Must choose one! I get
GcodeCNCDemo2AxisV2.ino:40:34: fatal error: Adafruit_MotorShield.h: No such file or directory
compilation terminated.
I see that you mention updating the files on github but to me they still show the same files.
https://github.com/MarginallyClever/GcodeCNCDemo2014-09-08 at 16:50 #6767AnonymousInactivehow do you get this -1 value?
What if you turn on “send carriage return” and type “M114” without the “;”?
I checked in an update that includes arduino_libraries/ which should solve your “Where is adafruit_motorshield.h?” question.
2014-09-08 at 21:29 #6768AnonymousInactiveHello,
Thanks for the update. V2 Now compiles but still not functioning properly.With carriage return and no ; it just echos what I type
When I output val inside parse number I only get . -1.00 for whatever number I use
G00 X200;
Val: -1.00
Val: -1.00/**
* Look for character /code/ in the buffer and read the float that immediately follows it.
* @return the value found. If nothing is found, /val/ is returned.
* @input code the character to look for.
* @input val the return value if /code/ is not found.
**/
float parsenumber(char code,float val) {
char *ptr=buffer;
while(ptr && *ptr && ptr<buffer+sofar) {
if(*ptr==code) {
return atof(ptr+1);
}
ptr=strchr(ptr,' ')+1;
}
Serial.print("Val: ");Serial.println(val);
return val;
}2014-09-09 at 16:23 #6769AnonymousInactiveSomewhere in the code it’s calling parsenumber(‘M’,-1); for some reason your buffer appears empty at this point, so it returns the default number -1. I have time booked tomorrow to run my test machines and see if the code is broken for everyone.
2014-09-09 at 23:00 #6770AnonymousInactiveI just updated and tested GcodeCNC2AxisV2. (commit #9)
I also removed GcodeCNC2AxisV1 since the two versions are now merged.It worked before and after, but now I’ve added line numbering and checksums so it can be used from from gCodeSender.
I am using Arduino 1.0.5. If you are still having trouble with 1.5.7, tell Arduino and switch back to an earlier version until they fix it.
2014-09-10 at 00:18 #6771AnonymousInactiveThat makes it work even with 1.5.7 of Arduino. Thank you.
-
AuthorPosts
- You must be logged in to reply to this topic.