1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-01 03:47:23 +03:00

Moving SPI pin initialization from constructor to begin() function. That way, the SPI library won't alter any pin states unless / until you call begin().

This commit is contained in:
David A. Mellis
2010-08-07 21:24:49 +00:00
parent 08feacbb40
commit b89d8a9c11
5 changed files with 20 additions and 23 deletions

View File

@ -36,13 +36,14 @@ const int chipSelectPin = 7;
void setup() {
Serial.begin(9600);
// initalize the data ready and chip select pins:
pinMode(dataReadyPin, INPUT);
pinMode(chipSelectPin, OUTPUT);
// start the SPI library:
SPI.begin();
// initalize the data ready and chip select pins:
pinMode(dataReadyPin, INPUT);
pinMode(chipSelectPin, OUTPUT);
//Configure SCP1000 for low noise configuration:
writeRegister(0x02, 0x2D);
writeRegister(0x01, 0x03);