mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-07 01:54:26 +01:00
Update DigitalPotControl.ino
Fixing SPI communication with a delay as pointe out in #6395
This commit is contained in:
parent
6b4a3a6d9e
commit
f7a395fbdb
@ -63,9 +63,11 @@ void loop() {
|
|||||||
void digitalPotWrite(int address, int value) {
|
void digitalPotWrite(int address, int value) {
|
||||||
// take the SS pin low to select the chip:
|
// take the SS pin low to select the chip:
|
||||||
digitalWrite(slaveSelectPin, LOW);
|
digitalWrite(slaveSelectPin, LOW);
|
||||||
|
delay(100);
|
||||||
// send in the address and value via SPI:
|
// send in the address and value via SPI:
|
||||||
SPI.transfer(address);
|
SPI.transfer(address);
|
||||||
SPI.transfer(value);
|
SPI.transfer(value);
|
||||||
|
delay(100);
|
||||||
// take the SS pin high to de-select the chip:
|
// take the SS pin high to de-select the chip:
|
||||||
digitalWrite(slaveSelectPin, HIGH);
|
digitalWrite(slaveSelectPin, HIGH);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user