Problem with sketch for mini CNC plotter

Unlocked.

So, I'm back after couple days of trying to fix avatar (still don;t know if anything changed)
Anyway, sketch compiles but when trying to upload i get error.

Arduino:1.8.13 (Windows 10), Płytka:"Arduino Uno"

Szkic używa 10762 bajtów (33%) pamięci programu. Maksimum to 32256 bajtów.

Zmienne globalne używają 706 bajtów (34%) pamięci dynamicznej, pozostawiając 1342 bajtów dla zmiennych lokalnych. Maksimum to 2048 bajtów.

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x90

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x90

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x90

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x90

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x90

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x90

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x90

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x90

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x90

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x90

Problem z wgrywaniem na płytkę. (Error trying to upload to board)

Additional info (might help):
OS Win10
I'm using Arduino Uno R3 clone
Arduino IDE 1.8.13
I've unpluged L293D board before uploading so nothing is connected to Arduino beside USB cable (I'm using one from my old printer)

Make sure you selected the correct COM port in the IDE. Be aware that they sometimes change as USB devices are plugged in and removed.

wildbill:
Make sure you selected the correct COM port in the IDE. Be aware that they sometimes change as USB devices are plugged in and removed.

I got COM1 (only one i got) selected all time so it isn't problem here.
Will switching to old bootloader help? (I got clone Uno R3)

COM 1 & 2 are reserved by/for windows and almost certainly NOT your board.

Other drivers are mentioned in the links below for clones.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

After uninstalling COM 1 and installing CH340 drivers works like a charm

Sweet.

That sounds more like it !

Clones are just as good for CNC type work as a real Arduino.

So, I had to use code with old Adafruit motor library because with the new one motors didn’t run.
After uploading g-code to g-control X and Y axis move only half the distance they can and after a while I get: Command not recognized: M18.
Guy in comments linked fix for that

default:[color=#111111][/color]
if ((buffer[0] == ‘1’) && (buffer [1] == ‘8’)){ // M18 = drives off[color=#111111][/color]
Serial.println( “M18: we’re done, turn drives off”);[color=#111111][/color]
myStepperX.release();[color=#111111][/color]
myStepperY.release();[color=#111111][/color]
}[color=#111111][/color]
else {[color=#111111][/color]
Serial.print( “Command not recognized : M”);[color=#111111][/color]
Serial.println( buffer );[color=#111111][/color]
}

However after using this new errors appear

Arduino:1.8.13 (Windows 10), Płytka:"Arduino Uno"

Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

Detecting libraries used...

Alternatives for Servo.h: [Servo@1.1.6 Servo@1.1.7]

ResolveLibrary(Servo.h)

  -> candidates: [Servo@1.1.6 Servo@1.1.7]

Alternatives for AFMotor.h: [Adafruit-Motor-Shield-library-master@1.0.1]

ResolveLibrary(AFMotor.h)

  -> candidates: [Adafruit-Motor-Shield-library-master@1.0.1]

Generating function prototypes...

Kompilowanie szkicu...

sketch_mar07a:261:19: error: stray '\342' in program

 if ((buffer[0] == ‘1’) &&

                   ^

sketch_mar07a:261:20: error: stray '\200' in program

 if ((buffer[0] == ‘1’) &&

                    ^

sketch_mar07a:261:21: error: stray '\230' in program

 if ((buffer[0] == ‘1’) &&

                     ^

sketch_mar07a:261:23: error: stray '\342' in program

 if ((buffer[0] == ‘1’) &&

                       ^

sketch_mar07a:261:24: error: stray '\200' in program

 if ((buffer[0] == ‘1’) &&

                        ^

sketch_mar07a:261:25: error: stray '\231' in program

 if ((buffer[0] == ‘1’) &&

                         ^

sketch_mar07a:262:16: error: stray '\342' in program

 (buffer [1] == ‘8’)){ // M18 =

                ^

sketch_mar07a:262:17: error: stray '\200' in program

 (buffer [1] == ‘8’)){ // M18 =

                 ^

sketch_mar07a:262:18: error: stray '\230' in program

 (buffer [1] == ‘8’)){ // M18 =

                  ^

sketch_mar07a:262:20: error: stray '\342' in program

 (buffer [1] == ‘8’)){ // M18 =

                    ^

sketch_mar07a:262:21: error: stray '\200' in program

 (buffer [1] == ‘8’)){ // M18 =

                     ^

sketch_mar07a:262:22: error: stray '\231' in program

 (buffer [1] == ‘8’)){ // M18 =

                      ^

sketch_mar07a:264:17: error: stray '\342' in program

 Serial.println( “M18: we’re

                 ^

sketch_mar07a:264:18: error: stray '\200' in program

 Serial.println( “M18: we’re

                  ^

sketch_mar07a:264:19: error: stray '\234' in program

 Serial.println( “M18: we’re

                   ^

sketch_mar07a:264:27: error: stray '\342' in program

 Serial.println( “M18: we’re

                           ^

sketch_mar07a:264:28: error: stray '\200' in program

 Serial.println( “M18: we’re

                            ^

sketch_mar07a:264:29: error: stray '\231' in program

 Serial.println( “M18: we’re

                             ^

sketch_mar07a:265:22: error: stray '\342' in program

 done, turn drives off”);

                      ^

sketch_mar07a:265:23: error: stray '\200' in program

 done, turn drives off”);

                       ^

sketch_mar07a:265:24: error: stray '\235' in program

 done, turn drives off”);

                        ^

sketch_mar07a:270:15: error: stray '\342' in program

 Serial.print( “Command not

               ^

sketch_mar07a:270:16: error: stray '\200' in program

 Serial.print( “Command not

                ^

sketch_mar07a:270:17: error: stray '\234' in program

 Serial.print( “Command not

                 ^

sketch_mar07a:271:15: error: stray '\342' in program

 recognized : M”);

               ^

sketch_mar07a:271:16: error: stray '\200' in program

 recognized : M”);

                ^

sketch_mar07a:271:17: error: stray '\235' in program

 recognized : M”);

                 ^

C:\Users\wikto\Desktop\sketch_mar07a\sketch_mar07a.ino: In function 'void processIncomingLine(char*, int)':

sketch_mar07a:197:7: error: 'penUp' was not declared in this scope

       penUp();

       ^~~~~

C:\Users\wikto\Desktop\sketch_mar07a\sketch_mar07a.ino:197:7: note: suggested alternative: 'penZUp'

       penUp();

       ^~~~~

       penZUp

sketch_mar07a:200:7: error: 'penDown' was not declared in this scope

       penDown();

       ^~~~~~~

C:\Users\wikto\Desktop\sketch_mar07a\sketch_mar07a.ino:200:7: note: suggested alternative: 'penZDown'

       penDown();

       ^~~~~~~

       penZDown

sketch_mar07a:227:9: error: 'drawLine' was not declared in this scope

         drawLine(newPos.x, newPos.y );

         ^~~~~~~~

C:\Users\wikto\Desktop\sketch_mar07a\sketch_mar07a.ino:227:9: note: suggested alternative: 'rewind'

         drawLine(newPos.x, newPos.y );

         ^~~~~~~~

         rewind

sketch_mar07a:263:1: error: 'drives' was not declared in this scope

 drives off

 ^~~~~~

C:\Users\wikto\Desktop\sketch_mar07a\sketch_mar07a.ino:263:1: note: suggested alternative: 'div'

 drives off

 ^~~~~~

 div

sketch_mar07a:270:18: error: 'Command' was not declared in this scope

 Serial.print( “Command not

                  ^~~~~~~

sketch_mar07a:282:35: error: a function-definition is not allowed here before '{' token

 void drawLine(float x1, float y1) {

                                   ^

sketch_mar07a:389:14: error: a function-definition is not allowed here before '{' token

 void penUp() {

              ^

sketch_mar07a:401:16: error: a function-definition is not allowed here before '{' token

 void penDown() {

                ^

sketch_mar07a:412:1: error: expected '}' at end of input

 }

 ^

sketch_mar07a:412:1: error: expected '}' at end of input

sketch_mar07a:412:1: error: expected '}' at end of input

sketch_mar07a:412:1: error: expected '}' at end of input

Znaleziono wiele bibliotek w "Servo.h"

Wykorzystane: C:\Users\wikto\Documents\Arduino\libraries\Servo

Niewykorzystane: C:\Program Files (x86)\Arduino\libraries\Servo

Użycie biblioteki Servo w wersji 1.1.7 z folderu: C:\Users\wikto\Documents\Arduino\libraries\Servo 

Użycie biblioteki Adafruit-Motor-Shield-library-master w wersji 1.0.1 z folderu: C:\Users\wikto\Documents\Arduino\libraries\Adafruit-Motor-Shield-library-master 

exit status 1

stray '\342' in program

I’ll link ino file below (letters limit)

sketch_mar07a.ino (10 KB)

Have to admit I don't know that "g-control" program at all so I don't even know where to get it to try ?

Most g-code senders rely on you having installed GRBL to the board first then closing out the IDE and swapping to the sender program to send regular g-code that was generated with a suitable processor.
Once installed GRBL becomes the translator from the UNO to the shield.

GRBL is a SUBSET of G-Code so not all commands are implemented or have to be substituted by a form of macro if the sender allows those.

See HERE for what is and is not supported.
Note that version 1.1 H or F are the latest versions.

I might be wrong but it seems like program written in processing 3
specially for this project. G-code is sent to Arduino using this. In
processing I got "Command not recognized: M18" but fix that guy in
comments linked is creating errors and I don't know how to correct it so
I linked his fix, error message and ino file with full script (with
uploaded fix).

Thats would explain why I know nothing about it.
It is sort of running a program to be able to run a sketch on the computer to translate g0-code to send to the Arduino which then needs to perform an action in terms of CNC.
Quite an inefficient method IMHO.

There are easier sender programs than PROCESSING.
Most of the others also have filters to negate bad or unsupported commands.
I would presume you have downloaded some g-code from somewhere to use as a test.
If that is the case then refer to post #28

My own preference is for UGS or LASERGRBL and I have never been let down by either of them.
Lasergrbl as the name suggests is for laser cnc work with Arduino’s and also generates its g-code directly from pictures

There are plenty of others but that’s up to the user to decide what they are comfortable with.
If you use the forum search for GRBL or UGS or LASER GRBL you will find plenty of threads to walk you through those and more.

It does sound like you are trying to run before you have learned to walk and any form of CNC work is not as simple as that. Maybe take some time to read up more ?

sketch_mar07a:261:21: error: stray '\230' in program

 if ((buffer[0] == '1') &&

That kind of error usually means you copied and pasted a sketch from an HTML page and got a bunch of non-printable characters. I find that re-typing the character usually works. The ":21: error:" means that the problem character is near the 21st character in the line.

johnwasser:

sketch_mar07a:261:21: error: stray '\230' in program

if ((buffer[0] == '1') &&




That kind of error usually means you copied and pasted a sketch from an HTML page and got a bunch of non-printable characters. I find that re-typing the character usually works. The ":21: error:" means that the problem character is near the 21st character in the line.

That helped me alot I've managed to fix it and it compiles.
Still something strange happens when I upload gcode to Arduino.
Y axis (I mean left right correct me if I'm wrong) works but suddenly motor stops and starts vibrating when any other axis starts moving. Basically it goes left right but if anything other moves up or down or servo moves it just stops and after a while I once again get M18 message mentioned before (I've installed fix for it but I don't know if anything changed).

ballscrewbob:
It does sound like you are trying to run before you have learned to walk and any form of CNC work is not as simple as that. Maybe take some time to read up more ?

I know CNC isn't best project for beginner with no experience at all. I've chosen it only because guide seemed detailed and I thought I wouldn't encounter troubles with coding and other things (because code was already done by someone else).

It is not uncommon to find issues in other peoples work.
Copy paste being only one of many issues that face users.

This is why we often ask for explicit working links etc. to items as mentioned in almost all the README at the top of each page.

A new person may not spot some of the errors but many people in here are often experienced to be able to see and give you that "Ahhh Haaa" moment.

Asking for the final time for the links and any other useful info you may have before I call it quits in this thread.

Bob.

ballscrewbob:
Asking for the final time for the links and any other useful info you may have before I call it quits in this thread.

Bob.

I provided links in post #1
https://electricdiylab.com/how-to-make-arduino-mini-cnc-plotter-machine/ (for some reason site works ONLY on phone)

Here's simillar project How to Make Mini CNC 2D Plotter Using Scrap DVD Drive, L293d Motor Shield & Arduino : 8 Steps (with Pictures) - Instructables (this one works on pc and they are basically same project with little differences)

I did everything like in links above, plotter is built but here's problem with one axis like I've mentioned above.

The first link balks with my antivirus so I wont be looking at that one.

That second link uses the older 293 chips and is not best suited for any real cnc work being both power hungry and limited in the current capacity.

These are by far the prefered shield for CNC work

Both projects use 293 shield.

I've tested other g-code and it doesn't give me M18 but it looks like Y axis doesn't know its location (it moves to the left even when it reached end and just keeps vibrating) other time it struggles to move and sometimes it moves an inch (it should smoothly move left and right) but still vibrates and doesn't work as it should.

Possible inadequate power supply or possible wiring issue are both common signs of that.

Im powering shield and Arduino using usb cable. I've tried rewiring but it didn't help. Is there a chance that I've connected motor to wrong side of motor shield? (does it matter?)

Well there is a good chunk of your issue as the driver board needs more amps than a USB port will give it.
Max (usually) from a single USB port is 500mA of which those old type chips will sink a good part of BEFORE they can work the motors.

A seperate supply with a good current rating would be a good start.