Arduino Nano with 328P, digital pins, and pin change interrupts

Hello Members,

I am programming an Arduino Nano to behave as a brushless DC motor controller.
I am using the PID v1 library, a brushless motor controller, and a brushless motor with planetary
gearbox, and encoder. Thanks to this forum (Nick Gammon and others) I have pin change interrupts
for the encoder outputs working correctly.

As the encoder has an index pulse, I have decided to use the index pulse to set limits for the
movement of the motor. I use the PID for speed control, and count index pulses, one per revolution of the motor to stop the motor at its limit points. I was using limit switches for this. The motor drives a timing belt, which moves a carriage assy on rails back and forth, when the carriage gets near the end of travel, it hits a limit switch, and motor stops turning. Press a button, and the carriage moves in the opposite direction until the other limit switch.

I set up a bread board test with the motor control board (the Nano, the BLDC controller,etc) and I used an Arduino Uno to count the index pulses. I am using Digital Pin 3 (pulled high) on the Nano, when this pin is grounded thru the limit switch, the motor stops.

I set the Uno up using Dig Pin 8 to count the index pulses from the motor as it turns, and used Dig Pin 2
to go low when the index count reaches 600. I hooked the dig pin 2 from the Uno to the dig pin 3 on the nano and started the motor, the motor turns, the carriage moves, and when the Uno counts 600 index pulses, the pin on the Uno takes the pin (3) on the Nano low, and the motor stops. All seems to be fine. I am using a 10k resistor to pull up pin 3 on the Nano.

So, now I wanted to incorporate the counting function on the Uno into the code I am using for the Nano. I do have extra digital pins on the Nano that are not being used. I was hoping to use dig pin 8 on the Nano to count index pulses (via a pin change interrupt vector), and take pin 4 low when the count reaches 600. I connected pin 4 as output, and pin 3 as input on the Nano. It seems that I cannot take the pin 3 low using pin 4. I am unable to change pin 3 from high to low using pins on the Nano.

If I use a limit switch, or the Uno (i.e. external devices) I can take the Nano pin 3 from high to low.

Is there some sort of limitation in using the digital pins on the Nano for multiple detection?
I have pin change interrupts for pins 11 and 13 for the encoder, and one for pin 8 to count index pulses, etc.

Any suggestions?

Thanks very much,

ewholz
I can attach code if required

When you wanted one Arduino to let the other know it was time to stop you used a pin and sent a signal. Doing that for one Arduino to communicate with itself is just plain silly. Instead of sending out a signal on a pin and then receiving it on another pin on the same Arduino, why not just put the code to stop the motor where you currently have the code to send that signal on pin 4.

Hello,
Yes, I agree with your suggestion. I came up with that solution, after I made the post! Thanks for the reply