Compiling issue

Hi Arduino Community

I recently built a camera slider and i am having issues with the code i found online. You can give me a screwdriver and i will build you a house but as soon as i see a computer i am completely lost!

I could not add the code since it exceeds the maximum of 9000 characters but here is the link to it:

And this is the error i get:

Arduino: 1.8.2 (Windows 8.1), Board: “Arduino/Genuino Uno”

C:\Users\Dominik\Documents\Arduino\sketch_may08a\sketch_may08a.ino:19:22: fatal error: MsTimer2.h: No such file or directory

#include <MsTimer2.h>


compilation terminated.

I built the following slider with the same parts:

I hope someone is able to help me with this.

Kind regards


I think the Arduino software doesn't know the library 'MsTimer2' which you are including in line 20.
Try Sketch>Include Library>Manage Libraries, search for 'MsTimer2' and install it.
This should fix your issue.

MsTimer2.h: No such file or directory

Have you got the file and if so where is it located ?

You need to download and install the library "MStimer2" in your sketchbook/libraries folder:

You guys are awesome! Thank you so much!

Hi Community!

I am having another issue with my project. The slider works just fine but it sends power continuously to the camera and not just after a step of the motor. If i have to camera in fast shooting mode it just shoots and never stops.

Would anybody be so friendly and have a look at the code above?

Thanks in advance!


  //at end of each step

if (currentStepsInt > 0 && currentStep % intervalDistance == 0) {    //if current number of motor steps is divisible by the number of motor steps in a camera step, fire the camera
      digitalWrite(trig, HIGH); //trigger camera shutter
      digitalWrite(trig, LOW);    //reset trigger pin
      delay((shutterDuration * 1000) - 80); //delay needs changing to timer so stop button can be polled

This looks like it should only raise the trigger for 80 milliseconds. What is the hardware on the output of this pin? Usually cameras need LOW to trigger the shutter, but you also don't want to connect the Arduino directly so there should be some relay or opto-isolator there, which may invert the output.

On the picture you see my setup. Red and white are going to the camera, black (21 on bread board) to ground and yellow to pin nr 13 on my arduino uno.

Thanks for your help!


And the black thing behind the wires?

Please draw a schematic. A pencil sketch photographed badly with a phone is acceptable.

This is how it looks.

Thank you very much

OK, which transistor?

To use a bipolar transistor like that, you need to know more about the voltage and current coming from the camera. Do you know the voltage and current?

Here’s the OP’s schematic…


I used a D882 Transistor. Did not think about voltage and current coming from the camera. I use a canon mark III 5d. I guess i screwed up big time.

Don't use pin 13 as that already has a resistor on it!


"Don't use pin 13 as that already has a resistor on it!"

I assume you are referring to an Uno? It has no resistor on it.
D13 connects to the input of a voltage comparator, which then drives an LED/resistor.

The D13 is otherwise unemcumbered.

Otherwise, please clarify your response.

I checked the project again and i realized i used a different transistor than the publisher of the project. He uses a BC109 transistor and i use a D882. Do you think this is the problem?

You may do better with a 5v SPST NO reed relay instead of the transistor. They can come with a built in clamping diode on the coil.

Something like these

Thanks i will try that!