From 22ea8d8f78bc3e327736eca5ca8b2f1050abb57a Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 26 Mar 2019 01:10:59 -0700 Subject: [PATCH] Add necessary delays to SPI DigitalPotControl example According to https://github.com/arduino/Arduino/issues/6395, these delays are required for the code to work. --- libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino b/libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino index c7afcc0a..8719058e 100644 --- a/libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino +++ b/libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino @@ -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); }