Go Down

Topic: Re-purposing the code for a digital potentiometer? (Read 121 times) previous topic - next topic

electricviolin

I took a look at the code here: http://arduino.cc/en/Tutorial/SPIDigitalPot

I notice that they use an arduino uno and they said
" * CS - to digital pin 10  (SS pin)
  * SDI - to digital pin 11 (MOSI pin)
  * CLK - to digital pin 13 (SCK pin)"

I need to use this with an arduino mega, so how would I wire it differently and how would I code it differently? Do I just use the same digital pins at described, or are the SS, MOSI, and SCK pins different on the arduino Mega? Thanks!

Docedison

--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

UKHeliBob

The equivalent pins on the Mega are

51 (MOSI)
52 (SCK)
53 (SS)

See http://arduino.cc/en/Main/ArduinoBoardMega2560

I have not looked at the link to the code for the Uno but it should just be a matter of substituting the Mega pin numbers for the equivalent Uno ones in the code.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

electricviolin

Okay, Thanks! I just want to check though, I do not have to change anything else in the code, do I?

UKHeliBob

You should only need to change the pin numbers to match the Mega, not the code.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up