I spent a couple of hours trying to control a PMODDPOT with an Arduino Duemilanove this afternoon. A sketch of my wiring is attached. The code that I am working with is below. Is it obvious to you guys what I am doing wrong here? (NOTE: Vcc is 5.2V). NOTE: I have some experience with arduino but this is my first project that uses SPI.
Thanks in advance for your help.
#include <SPI.h>
static byte i;
const int slaveSelectPin = 10;
void setup() {
// put your setup code here, to run once:
pinMode(slaveSelectPin, OUTPUT);
SPI.begin();
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
i++;
// have tried 14000000,1400000,140000,14000 for SpeedMaximum
// (i.e the first parameter to SPISetup)
// have tried SPI_MODE0 thru SPI_MODE3).
// have tried both LSBFIRST and MSBFIRST
SPI.beginTransaction(SPISettings(14000,MSBFIRST,SPI_MODE0));
digitalWrite(slaveSelectPin, LOW);
SPI.transfer(i);
digitalWrite(slaveSelectPin,HIGH);
SPI.endTransaction();
delay(500);
if(i>254){
i=0;
}
Serial.println(i);
}
Question
shanham67
All,
I spent a couple of hours trying to control a PMODDPOT with an Arduino Duemilanove this afternoon. A sketch of my wiring is attached. The code that I am working with is below. Is it obvious to you guys what I am doing wrong here? (NOTE: Vcc is 5.2V). NOTE: I have some experience with arduino but this is my first project that uses SPI.
Thanks in advance for your help.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.