Pages: [1]   Go Down
Author Topic: Re-purposing the code for a digital potentiometer?  (Read 102 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2925
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

try this...   http://forum.arduino.cc/index.php?topic=125908.0. Second entry on the Microcontrollers page...

Doc
Logged

--> 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

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 117
Posts: 4329
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 117
Posts: 4329
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You should only need to change the pin numbers to match the Mega, not the code.
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Pages: [1]   Go Up
Jump to: