CHANGE IN THE LIBRARY

Greetings,
I want to use this mma7361 accelerometer library.In this library mma7361 uses 9,11,12,13 digital pins of arduino.
If I change these to digital pins 2,3,4,5.Will the library still work?.Actually I want to use a shield

Any other suggestions are welcomed.
Thank you in advance.

AcceleroMMA7361.cpp (10.3 KB)

Hi there

From the library file, it looks like calling the begin() method with no parameters makes it use the pins you mentioned: sleepPin = 13, selfTestPin = 12, zeroGPin = 9, gSelectPin = 11.

But you can also call begin() with parameters. The prototype in the file is ...

void AcceleroMMA7361::begin(int sleepPin, int selfTestPin, int zeroGPin, int gSelectPin, int xPin, int yPin, int zPin)

So your program would have something like:

myAccel.begin(2, 3, 4, 5, A0, A1, A2);  // CHECK THAT THE ORDER OF THE PINS IS WHAT YOU WANT :-)

You don't need to edit the library.

By the way, you also mentioned using a shield. Can you explain more?

All the best

Ray

Thanks for the reply actually if I use the mentioned shield the pins 10,11,12,13 are not able to be used for this purpose.

if I use the mentioned shield the pins 10,11,12,13 are not able to be used for this purpose

That's not true. LOOK AT THE SCHEMATIC (attached)
8,11, & 13 are dedicated. Pin-8 is the SPI SS chip select.
Pins 10 & 12 are not used.

microSD_Shield_v13_Schematic.pdf (186 KB)

Thanks for the response .