Skip to content

Commit

Permalink
Add necessary delays to SPI DigitalPotControl example
Browse files Browse the repository at this point in the history
According to arduino/Arduino#6395, these delays are required for the SPI communication with the digital potentiometer to work.
  • Loading branch information
SimonePDA authored and per1234 committed Mar 26, 2019
1 parent 00f50b3 commit 2729d38
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ void loop() {
void digitalPotWrite(int address, int value) {
// take the SS pin low to select the chip:
digitalWrite(slaveSelectPin, LOW);
delay(100);
// send in the address and value via SPI:
SPI.transfer(address);
SPI.transfer(value);
delay(100);
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin, HIGH);
}

0 comments on commit 2729d38

Please sign in to comment.