mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Run new astyle formatter against all the examples
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
/*
|
||||
SD card datalogger
|
||||
|
||||
This example shows how to log data from three analog sensors
|
||||
|
||||
This example shows how to log data from three analog sensors
|
||||
to an SD card using the SD library.
|
||||
|
||||
|
||||
The circuit:
|
||||
* analog sensors on analog ins 0, 1, and 2
|
||||
* SD card attached to SPI bus as follows:
|
||||
@ -11,13 +11,13 @@
|
||||
** MISO - pin 12
|
||||
** CLK - pin 13
|
||||
** CS - pin 4
|
||||
|
||||
|
||||
created 24 Nov 2010
|
||||
modified 9 Apr 2012
|
||||
by Tom Igoe
|
||||
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include <SPI.h>
|
||||
@ -31,9 +31,9 @@ const int chipSelect = 4;
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Open serial communications and wait for port to open:
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while (!Serial) {
|
||||
while (!Serial) {
|
||||
; // wait for serial port to connect. Needed for Leonardo only
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ void setup()
|
||||
// make sure that the default chip select pin is set to
|
||||
// output, even if you don't use it:
|
||||
pinMode(10, OUTPUT);
|
||||
|
||||
|
||||
// see if the card is present and can be initialized:
|
||||
if (!SD.begin(chipSelect)) {
|
||||
Serial.println("Card failed, or not present");
|
||||
@ -62,7 +62,7 @@ void loop()
|
||||
int sensor = analogRead(analogPin);
|
||||
dataString += String(sensor);
|
||||
if (analogPin < 2) {
|
||||
dataString += ",";
|
||||
dataString += ",";
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,11 +76,11 @@ void loop()
|
||||
dataFile.close();
|
||||
// print to the serial port too:
|
||||
Serial.println(dataString);
|
||||
}
|
||||
}
|
||||
// if the file isn't open, pop up an error:
|
||||
else {
|
||||
Serial.println("error opening datalog.txt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user