Switched from Easy Driver to Big Easy Driver - now my optical sensor misfires

Well, I know it's been a while fellas, but I made the hardware corrections suggested here in this thread. Specifically, I added the Schmitt trigger, housed the optical sensor and shielded all the wires.

So far, so good! The sensor seems to be firing only when it's expected to fire. I'm not sure which of the listed changes are what did it, but at this point, I'm just happy it's working

The process took me a while because I actually had to fabricate a bunch of parts need to build the complete the machine. I'm in the process of assembling the entire thing. I've attached an image of the sensor housing for your viewing pleasure.

Anyway, thanks all you guys for your help. That was really awesome. I'll post again if anything comes up.

![|500x375](https://c1.staticflickr.com/3/2890/32872269682_ef9b208518_k.jpg" width="2048" height="1536" alt="IMG_3663")

@Robin2: I'm going to try those coding suggestions you made earlier once I get the machine assembled and basically running. Thanks!

Looks impressive.

...R

Robin2:
Looks impressive.

...R

Thanks!

With any luck it will actually be impressive!

I've been working on this project since October - making parts, coding, assembling and testing, etc. This is the first machine that I've ever designed and built myself. It's been an interesting ride to say the least.

void moveStepper() {
   noInterrupts();
   if (stepDue == true) {
     stepDue = false; // so you don't do the same steps twice
     interrupts();
     // code to cause the necessary steps to happen
   }
   else {
    interrupts();
   }
}

freekmagnet:
OK here's where I get confused. Am I correct in reading the above code as "if a condition is true then execute this function" but defaults to "execute this function" anyway? But I could see how moving the function out of the ISR could be advantageous.

No, you don't understand, there is a critical section here which must atomically decide whether to step or not and update the stepDue variable correctly. The critical section is protected with noInterrupts() / interrupts() macros.