Arduino Mega pin configuration

Hi.

I've created a program using shift registers to control digit displays. My pin layout for these registers is as follows:

//--Shift register variables--------------
const byte dataPin = 12;                  // arduino pin 12 to TPIC6B595 pin 3 serial in (SER IN)
const byte latchPin = 11;                 // arduino pin 11 to TPIC6B595 pin 12 latch signal (RCK)
const byte clockPin = 9;                  // arduino pin 9 to TPIC6B595 pin 13 clock (SRCK)

In another test project, I've also created a transmitter and receiver using NRF2401's and 2 arduinos. These use the following pins:

  • Pin 9 = CE (this I can change)
  • Pin 10 = CSN (this I can also change)
  • Pin 11 = MO (MOSI)
  • Pin 12 = MI (MISO)
  • Pin 13 = SCK

I now want to combine the 2 programs and use the one arduino (as well as another for the tranmitter. What my question is, can I use any other pins for dataPin 12 and latchPin 11 above (on a mega).

Are you using any library for your TPIC6B595 or do you drive that yourself?

If you are not using library, do you see in your code driving the TPIC6B595 anything other than digitalWrite and the likes?

Anything special that would suggest you can't just go and use any other reasonable pin?

For the shift registers program, I'm using the following libraries:

#include <DS3232RTC.h>
#include <Streaming.h>
#include <Time.h>
#include <Timezone.h>
#include <Wire.h>

So I don't "think" there is any reference to pins 9, 11 and 12 noted above.

For the RNFs, I'm using the following libraries:

#include <SPI.h>
#include "RF24.h"

These I think "do" call up pins 11, 12 and 13, so I'd rather not change those libraries and dedicate 11 and 12 to the RNF part of the program.

I've tried to change the shift registers to 2, 3 and 4 and it didn't work. I then tried 6, 7, 13. Neither worked. Andy ideas?

My apologies - I found the problem.

Given I've been swapping between a Mega and Uno, I forgot to change it back to "Mega" so the upload with new pin numbers were not loading properly

I swapped the shift register pins:
dataPin = 12 to 4
latchPin = 11 to 3
clockPin = 9 to 2

Works perfectly.
Sorry again.