Skip to content

Commit 5aacb82

Browse files
author
Federico Fissore
committed
Run new astyle formatter against all the examples
1 parent 36f7597 commit 5aacb82

File tree

6 files changed

+110
-110
lines changed

6 files changed

+110
-110
lines changed

examples/CardInfo/CardInfo.ino

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
/*
2-
SD card test
3-
2+
SD card test
3+
44
This example shows how use the utility libraries on which the'
55
SD library is based in order to get info about your SD card.
66
Very useful for testing a card when you're not sure whether its working or not.
7-
7+
88
The circuit:
99
* SD card attached to SPI bus as follows:
1010
** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila
1111
** MISO - pin 12 on Arduino Uno/Duemilanove/Diecimila
1212
** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila
13-
** CS - depends on your SD card shield or module.
13+
** CS - depends on your SD card shield or module.
1414
Pin 4 used here for consistency with other Arduino examples
1515
16-
16+
1717
created 28 Mar 2011
18-
by Limor Fried
18+
by Limor Fried
1919
modified 9 Apr 2012
2020
by Tom Igoe
2121
*/
22-
// include the SD library:
22+
// include the SD library:
2323
#include <SPI.h>
2424
#include <SD.h>
2525

@@ -32,22 +32,22 @@ SdFile root;
3232
// Arduino Ethernet shield: pin 4
3333
// Adafruit SD shields and modules: pin 10
3434
// Sparkfun SD shield: pin 8
35-
const int chipSelect = 4;
35+
const int chipSelect = 4;
3636

3737
void setup()
3838
{
39-
// Open serial communications and wait for port to open:
39+
// Open serial communications and wait for port to open:
4040
Serial.begin(9600);
41-
while (!Serial) {
41+
while (!Serial) {
4242
; // wait for serial port to connect. Needed for Leonardo only
4343
}
4444

4545

4646
Serial.print("\nInitializing SD card...");
4747
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
48-
// Note that even if it's not used as the CS pin, the hardware SS pin
49-
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
50-
// or the SD library functions will not work.
48+
// Note that even if it's not used as the CS pin, the hardware SS pin
49+
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
50+
// or the SD library functions will not work.
5151
pinMode(10, OUTPUT); // change this to 53 on a mega
5252

5353

@@ -60,12 +60,12 @@ void setup()
6060
Serial.println("* did you change the chipSelect pin to match your shield or module?");
6161
return;
6262
} else {
63-
Serial.println("Wiring is correct and a card is present.");
63+
Serial.println("Wiring is correct and a card is present.");
6464
}
6565

6666
// print the type of card
6767
Serial.print("\nCard type: ");
68-
switch(card.type()) {
68+
switch (card.type()) {
6969
case SD_CARD_TYPE_SD1:
7070
Serial.println("SD1");
7171
break;
@@ -91,7 +91,7 @@ void setup()
9191
Serial.print("\nVolume type is FAT");
9292
Serial.println(volume.fatType(), DEC);
9393
Serial.println();
94-
94+
9595
volumesize = volume.blocksPerCluster(); // clusters are collections of blocks
9696
volumesize *= volume.clusterCount(); // we'll have a lot of clusters
9797
volumesize *= 512; // SD card blocks are always 512 bytes
@@ -104,15 +104,15 @@ void setup()
104104
volumesize /= 1024;
105105
Serial.println(volumesize);
106106

107-
107+
108108
Serial.println("\nFiles found on the card (name, date and size in bytes): ");
109109
root.openRoot(volume);
110-
110+
111111
// list all files in the card with date and size
112112
root.ls(LS_R | LS_DATE | LS_SIZE);
113113
}
114114

115115

116116
void loop(void) {
117-
117+
118118
}

examples/Datalogger/Datalogger.ino

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/*
22
SD card datalogger
3-
4-
This example shows how to log data from three analog sensors
3+
4+
This example shows how to log data from three analog sensors
55
to an SD card using the SD library.
6-
6+
77
The circuit:
88
* analog sensors on analog ins 0, 1, and 2
99
* SD card attached to SPI bus as follows:
1010
** MOSI - pin 11
1111
** MISO - pin 12
1212
** CLK - pin 13
1313
** CS - pin 4
14-
14+
1515
created 24 Nov 2010
1616
modified 9 Apr 2012
1717
by Tom Igoe
18-
18+
1919
This example code is in the public domain.
20-
20+
2121
*/
2222

2323
#include <SPI.h>
@@ -31,9 +31,9 @@ const int chipSelect = 4;
3131

3232
void setup()
3333
{
34-
// Open serial communications and wait for port to open:
34+
// Open serial communications and wait for port to open:
3535
Serial.begin(9600);
36-
while (!Serial) {
36+
while (!Serial) {
3737
; // wait for serial port to connect. Needed for Leonardo only
3838
}
3939

@@ -42,7 +42,7 @@ void setup()
4242
// make sure that the default chip select pin is set to
4343
// output, even if you don't use it:
4444
pinMode(10, OUTPUT);
45-
45+
4646
// see if the card is present and can be initialized:
4747
if (!SD.begin(chipSelect)) {
4848
Serial.println("Card failed, or not present");
@@ -62,7 +62,7 @@ void loop()
6262
int sensor = analogRead(analogPin);
6363
dataString += String(sensor);
6464
if (analogPin < 2) {
65-
dataString += ",";
65+
dataString += ",";
6666
}
6767
}
6868

@@ -76,11 +76,11 @@ void loop()
7676
dataFile.close();
7777
// print to the serial port too:
7878
Serial.println(dataString);
79-
}
79+
}
8080
// if the file isn't open, pop up an error:
8181
else {
8282
Serial.println("error opening datalog.txt");
83-
}
83+
}
8484
}
8585

8686

examples/DumpFile/DumpFile.ino

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/*
22
SD card file dump
3-
3+
44
This example shows how to read a file from the SD card using the
55
SD library and send it over the serial port.
6-
6+
77
The circuit:
88
* SD card attached to SPI bus as follows:
99
** MOSI - pin 11
1010
** MISO - pin 12
1111
** CLK - pin 13
1212
** CS - pin 4
13-
13+
1414
created 22 December 2010
1515
by Limor Fried
1616
modified 9 Apr 2012
1717
by Tom Igoe
18-
18+
1919
This example code is in the public domain.
20-
20+
2121
*/
2222

2323
#include <SPI.h>
@@ -31,9 +31,9 @@ const int chipSelect = 4;
3131

3232
void setup()
3333
{
34-
// Open serial communications and wait for port to open:
34+
// Open serial communications and wait for port to open:
3535
Serial.begin(9600);
36-
while (!Serial) {
36+
while (!Serial) {
3737
; // wait for serial port to connect. Needed for Leonardo only
3838
}
3939

@@ -42,15 +42,15 @@ void setup()
4242
// make sure that the default chip select pin is set to
4343
// output, even if you don't use it:
4444
pinMode(10, OUTPUT);
45-
45+
4646
// see if the card is present and can be initialized:
4747
if (!SD.begin(chipSelect)) {
4848
Serial.println("Card failed, or not present");
4949
// don't do anything more:
5050
return;
5151
}
5252
Serial.println("card initialized.");
53-
53+
5454
// open the file. note that only one file can be open at a time,
5555
// so you have to close this one before opening another.
5656
File dataFile = SD.open("datalog.txt");
@@ -61,11 +61,11 @@ void setup()
6161
Serial.write(dataFile.read());
6262
}
6363
dataFile.close();
64-
}
64+
}
6565
// if the file isn't open, pop up an error:
6666
else {
6767
Serial.println("error opening datalog.txt");
68-
}
68+
}
6969
}
7070

7171
void loop()

examples/Files/Files.ino

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/*
22
SD card basic file example
3-
4-
This example shows how to create and destroy an SD card file
3+
4+
This example shows how to create and destroy an SD card file
55
The circuit:
66
* SD card attached to SPI bus as follows:
77
** MOSI - pin 11
88
** MISO - pin 12
99
** CLK - pin 13
1010
** CS - pin 4
11-
11+
1212
created Nov 2010
1313
by David A. Mellis
1414
modified 9 Apr 2012
1515
by Tom Igoe
16-
16+
1717
This example code is in the public domain.
18-
18+
1919
*/
2020
#include <SPI.h>
2121
#include <SD.h>
@@ -24,18 +24,18 @@ File myFile;
2424

2525
void setup()
2626
{
27-
// Open serial communications and wait for port to open:
27+
// Open serial communications and wait for port to open:
2828
Serial.begin(9600);
29-
while (!Serial) {
29+
while (!Serial) {
3030
; // wait for serial port to connect. Needed for Leonardo only
3131
}
3232

3333

3434
Serial.print("Initializing SD card...");
3535
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
36-
// Note that even if it's not used as the CS pin, the hardware SS pin
37-
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
38-
// or the SD library functions will not work.
36+
// Note that even if it's not used as the CS pin, the hardware SS pin
37+
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
38+
// or the SD library functions will not work.
3939
pinMode(10, OUTPUT);
4040

4141
if (!SD.begin(4)) {
@@ -56,23 +56,23 @@ void setup()
5656
myFile = SD.open("example.txt", FILE_WRITE);
5757
myFile.close();
5858

59-
// Check to see if the file exists:
59+
// Check to see if the file exists:
6060
if (SD.exists("example.txt")) {
6161
Serial.println("example.txt exists.");
6262
}
6363
else {
64-
Serial.println("example.txt doesn't exist.");
64+
Serial.println("example.txt doesn't exist.");
6565
}
6666

6767
// delete the file:
6868
Serial.println("Removing example.txt...");
6969
SD.remove("example.txt");
7070

71-
if (SD.exists("example.txt")){
71+
if (SD.exists("example.txt")) {
7272
Serial.println("example.txt exists.");
7373
}
7474
else {
75-
Serial.println("example.txt doesn't exist.");
75+
Serial.println("example.txt doesn't exist.");
7676
}
7777
}
7878

0 commit comments

Comments
 (0)