Errors and Troubleshooting your Projects

Programming is an experimental process and you should expect to break your code many times. When that happens, the best thing to do is start with whatever information you have and change one thing at a time until you have found the broken bit and fixed it. We break troubleshooting into two parts: hardware (the physical things) and software (the code).

These tips are presented as a numbered list (1,2,3…) but they aren't ordered steps. If you see the error, try option one, then see if your error is fixed. If not, try option two and then see if your error is fixed. Continue down the list.

Throughout the guide, you'll see text in quotes like “Library Name”. That is replacement text for the actual name of the library. So, if you are troubleshooting the Servo library, you should replace the words “Library Name” with “Servo” in your mind.


determine if your problem is with hardware or software:

1) Press 'compile' in your Arduino software. This is the 'check mark' button in the upper left. If there is a loading bar in the bottom-right and then the words 'Done Compiling', then the code is valid. That doesn't mean it will do what you expect, it just means there aren't any syntax errors. If you get an error there, you have a software problem.

Go to Software Troubleshooting

2) Replace a piece of hardware with an identical piece. If you expect an LED to turn on and it isn't, replace that LED with another LED. Does your project work now? If so, you had a hardware issue.

Go to Hardware Troubleshooting

Software troubleshooting

The Arduino software will show you an error message when it has trouble compiling your code and putting it on to Maker Board. These errors aren't always easy to decode, but we've assembled the most common errors and their most common solutions.

All of these recommendations assume that you have completed at least one successful upload of any program to the Maker Board. If you haven't ever been able to upload to Maker Board, you should check the download and installation instructions for the Arduino software. There may be a problem with the way the software is installed.

avrdude: stk500_getsync(): not in sync: resp=0x...
does not name a type
Class 'X' has no member named 'Y'
Expected 'X' before 'Y'
Port in use
Expected Unqualified ID before 'X'
'X' was not declared in this scope
Invalid device signature
“File Name”: No such file or directory
Conflicting Declaration
Expected Declaration before ' } ' token


avrdude: stk500_getsync(): not in sync: resp=0x...

This is a communication error between the Arduino software and Maker Board. A number of things can cause it. First, ensure that Maker Board is plugged in to your computer either directly or with a cable and the green power light is on.

1) Navigate to Tools → Port. Ensure that there is a check mark by one of the ports that doesn't say Bluetooth in the name.On Windows, select a port named “COM” and a number. On Mac, select a port named “/dev/cu.usbserial…..”

2) Navigate to Tools → Board. Ensure that “Arduino Uno” is selected.

3) Unplug the Maker Board completely from the computer, wait 5 seconds, and plug the Maker Board back in. This should restart the Maker Board and it will try again to communicate with the Arduino software.

4) Close all of the windows of the Arduino software (save your work first!). Unplug Maker Board, re-open the Arduino software and your program, and plug Maker Board back in.

5) Unplug Maker Board and restart your computer. Open the Arduino software and plug Maker Board back in.

Does not name a type

This error is most common when you are creating something in code: usually a variable or a library.

1) Look at each place where you declare a variable type (like bool, int, float, const). Are each of those words spelled correctly? Are they all lower case letters?

2) Look at each library that you included in your program. These are usually at the very top and use “# include <LibraryName.h> . Does the library name exactly match the spelling of the library you have included?

This step assumes that you have successfully uploaded a program using this library before. If you haven't, try uploading a code example from this library by navigating to File → Examples → “Library name” → “Program name”. If the example program does not upload, you may have a problem with how the library is installed on your computer. You may need to delete and reinstall the specific library folder to your Documents → Arduino → Libraries folder.

3) Did you include the library that your program is trying to use? Double check the spelling and capitalization of the library name. If you're not sure if you need the library, compare the functions that your program uses to the functions in this guide. If there are functions in your program that aren't in this guide, either you created those functions or a library is giving you access to those functions.

4) Check that the library is installed correctly. Navigate to your Documents → Arduino → libraries and then open the library folder in question. That library folder should contain at least a file ending in .cpp and a file ending in .h . It will probably include an 'Examples” folder. It should not contain another folder named 'library name ' with files inside of that.

Class 'X' has no member named 'Y'

This error is most common when you are using a library that gives you access to new methods. When you include the library Servo.h , for example, you now have access to the .attach() method. If you try to use .attach() without including the library, you'll see this error.

1) Look for misspellings in your program, especially around the methods. Check capitalization of the method names (these are names that should follow a period (.)).

2) Make sure that the library you're including does actually contain the method you want to use. How? Comment out the first line in your program that uses the method by putting two // marks in front of it. Now click 'Verify' again. If you get another error in the program the next time you used that method, you may be trying to use a method that doesn't exist in the library.

Expected 'X' before 'Y'

This is usually a syntax error: you may have forgotten to type something in that the program requires to run.

1) Check the void setup () section of the code. Does it have curly brace ( { ) after the parentheses? Does it end with a curly brace ( } ) before void loop?

2) Check the void loop section. Does it have a curly brace ( { ) after the parentheses? Does it end with a curly brace ( } ) at the end of the code?

3) Most lines of code end with a semicolon ( ; ) . Is the line that the error highlights missing a semicolon? Is the line above the highlighted line missing a semicolon?

4) Look for other elements of the code that need a 'matching pair'. Every time you use an open parenthesis ( ( ), you will need a closing parenthesis ( ) ). The same goes for curly braces ( { } ).

Port in use

This upload occurs when there is a problem with the communication between the computer and the Maker Board. This can be caused by choosing a different device from the Tools → Port menu or another device trying to talk over the USB serial port at the same time as Maker Board.

1) Unplug the Maker Board and plug it into a different USB port. Navigate to Tools → Port and select a non-Bluetooth port from the list. On Windows, select a port named “COM” with a number behind it. On Macintosh, select a port called “ /dev/cu.usbserial…..”.

2) Are you running a program that uses Serial.print() or Serial.println()? If so, sending data too quickly over the serial port can cause problems with uploads. Be sure to insert a delay(50); or more in your program loop and try to upload the program again. If you have trouble completing an upload, try the method from step 1 with your newly updated program.

3) Try unplugging Maker Board and closing all of the Arduino windows and quitting the Arduino software. Then, reopen the Arduino software and plug Maker Board back in to the computer.

4) If you still cannot get the program to upload on any of your USB ports, restart your computer. Other programs on your computer may try to use the serial port and these may be causing the problem.

Expected Unqualified ID before 'X'

1) This most commonly happens when you try to name a variable starting with a number. Variable names must start with letters.

'X' was not declared in this scope

This most likely means you tried to use a variable someplace where it hasn't been declared.

1) If the error has highlighted a line of your code, look at that line. Are you creating a variable on that line? If so, did you give it a type before giving it a name? Is the text for the type a different color? All valid variable types should turn blue when you type in those letters.

2) Are you using a variable in void loop() that you created inside void setup()? This is related to 'scoping': not all variables you create in the program are available to use in all other areas of a program.

Notes on scope: If you want to use a variable everywhere within your program, declare it at the top of the program, above void setup().

Sometimes, you want a variable to only exist in a limited scope. For example, if you create a for loop : for(int i=0; i<100; i++), the variable “ i ” only exists within that 'for' loop. You can create another for loop: for(int i=100; i>0; i--) and the variable “ i ” is brand new in that 'for' loop.

Invalid device signature

Usually means the wrong board is selected under the Tools → Boards menu.

1) Navigate to the Tools → Boards menu in the Arduino software. Click “Arduino Uno”

2) Unplug the Maker Board from the USB socket or cable. Plug it back in and make sure the power light is a steady green. If it isn't, make sure the board is turned correctly and has a snug fit in the socket.

3) If you are using the Maker Board directly in the USB socket, try using it with a cable.

“File Name”: No such file or directory

The IDE can't find the file mentioned in the highlighted line. Usually a library issue.

1) If the highlighted line is a library #include statement, make sure that you have spelled and capitalized the library name correctly in the #include line. If you aren't sure, navigate to File → Examples → “Library Name” and open one of the example programs. That program should have the library included correctly.

2) If the highlighted line is not a library, just try to upload the program 3 or 4 more times. Sometimes there is an error in the Arduino software when you try to upload.

3) Try copy/pasting the entire program to a new Arduino window and save the program under a new name. Try uploading the program from this new window.

These options assume that you have successfully uploaded code to this Maker Board using this library and this computer before. If you haven't, the library may not be installed correctly. To check, navigate to File → Examples → “Library Name” and open one of the example programs. Try to upload the example program to your Maker Board. If you still have this problem, the library may be installed incorrectly.

Conflicting Declaration

This one comes up almost exclusively when you declare a variable multiple times with different types, like declaring an 'int myVariable' and then 'float myVariable'

1) Change one of the variables' names. Make sure if you've already written code with two variables sharing the name to carefully separate them.

Expected Declaration before ' } ' token

This error is simple to understand and hard to fix. When you see this error, the Arduino software will almost always highlight the last closing brace ( } ) in the code. What the error really means, though, is that there are more closing braces ( } ) than opening braces.

The best way to find this error is start at the top of the loop and find each opening curly brace ( { ) in each “for” loop, “if” statement, and everywhere else in your code. Are you closing that command with a curly brace ( } ) when it is complete?

Review the syntax of each statement that you use in your code if you aren't sure how to use braces with your specific statement.

Hardware Troubleshooting

Hardware is the connection between the digital and physical worlds. It also requires a few new skills to ensure everything works properly. There are many types of hardware, so here we cover the most common issues that we run in to. Start at the top and try each solution. Doesn't solve the problem? Move to the next one.

If you’re using unchanged code from example projects and the example isn’t working like you expect it to, replace a component with one of the same type. For example, replace a red LED with a blue LED. If the unchanged code suddenly starts to work, it's a component problem.

1) Does the hardware hookup match the code? That is, if your code says digitalWrite(5,HIGH); , is your LED leg in pin 5? The ports are small and close together, so mix-ups happen all the time.

2) Be sure that the component is well ‘seated’ in the port when you plug it in. When a component is correctly placed into the port, you can turn the project upside down and nothing will fall out. If your components want to slip out of the ports, try inserting the ground pin diagonal to the signal pin. All of the ground row pins do the same thing, so they are interchangeable. This technique helps keep your components firmly inserted.

3) Ensure that none of the wire legs (leads) are touching each other on the same component. Also be sure the legs aren’t touch another component’s legs. Power may pass through the other legs instead of the component itself.

4) Some components can be oriented with either leg in a ground port and the other in a pin port. Some components cannot! Be sure to review your component cards and look for markings on the component itself: components with legs of different lengths, for example, usually need to be oriented a certain way.

5) Watch out for the 5V ports on your Maker Board. They are needed for some components, but plugging an LED into it and powering your project can ruin the LED by sending too much current through the LED. If you've accidentally plugged a component in to 5V and powered on the project, run a simple test program that uses that component to ensure that it still works.

6) It is possible for some components to stop working over time. LEDs can burn out and button legs can break. If you are having mysterious problems that you still cannot solve, try replacing your component with an identical one. If the replaced component starts working again, it may be time to buy a new component.

go to top