Skip to content

Commit f3eced4

Browse files
authored
Merge PR #529 "Use consistent formatting of all code" from per1234
Use consistent formatting of all code
2 parents 8f7f3dd + 1ec8dbe commit f3eced4

File tree

118 files changed

+570
-682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+570
-682
lines changed

AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc

+2-4
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,11 @@ int ledPin = 9; // LED connected to digital pin 9
7676
int analogPin = 3; // potentiometer connected to analog pin 3
7777
int val = 0; // variable to store the read value
7878
79-
void setup()
80-
{
79+
void setup() {
8180
pinMode(ledPin, OUTPUT); // sets the pin as output
8281
}
8382
84-
void loop()
85-
{
83+
void loop() {
8684
val = analogRead(analogPin); // read the input pin
8785
analogWrite(ledPin, val / 4); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
8886
}

Language/Functions/Advanced IO/pulseIn.adoc

+2-4
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,12 @@ The example prints the time duration of a pulse on pin 7.
6060
int pin = 7;
6161
unsigned long duration;
6262
63-
void setup()
64-
{
63+
void setup() {
6564
Serial.begin(9600);
6665
pinMode(pin, INPUT);
6766
}
6867
69-
void loop()
70-
{
68+
void loop() {
7169
duration = pulseIn(pin, HIGH);
7270
Serial.println(duration);
7371
}

Language/Functions/Analog IO/analogRead.adoc

+8-10
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,17 @@ The code reads the voltage on analogPin and displays it.
6565

6666
[source,arduino]
6767
----
68-
int analogPin = A3; // potentiometer wiper (middle terminal) connected to analog pin 3
69-
// outside leads to ground and +5V
70-
int val = 0; // variable to store the value read
68+
int analogPin = A3; // potentiometer wiper (middle terminal) connected to analog pin 3
69+
// outside leads to ground and +5V
70+
int val = 0; // variable to store the value read
7171
72-
void setup()
73-
{
74-
Serial.begin(9600); // setup serial
72+
void setup() {
73+
Serial.begin(9600); // setup serial
7574
}
7675
77-
void loop()
78-
{
79-
val = analogRead(analogPin); // read the input pin
80-
Serial.println(val); // debug value
76+
void loop() {
77+
val = analogRead(analogPin); // read the input pin
78+
Serial.println(val); // debug value
8179
}
8280
----
8381
[%hardbreaks]

Language/Functions/Analog IO/analogWrite.adoc

+5-7
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,13 @@ int ledPin = 9; // LED connected to digital pin 9
6262
int analogPin = 3; // potentiometer connected to analog pin 3
6363
int val = 0; // variable to store the read value
6464
65-
void setup()
66-
{
67-
pinMode(ledPin, OUTPUT); // sets the pin as output
65+
void setup() {
66+
pinMode(ledPin, OUTPUT); // sets the pin as output
6867
}
6968
70-
void loop()
71-
{
72-
val = analogRead(analogPin); // read the input pin
73-
analogWrite(ledPin, val / 4); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
69+
void loop() {
70+
val = analogRead(analogPin); // read the input pin
71+
analogWrite(ledPin, val / 4); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
7472
}
7573
----
7674
[%hardbreaks]

Language/Functions/Characters/isAlpha.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ isAlpha(thisChar)
5050

5151
[source,arduino]
5252
----
53-
if (isAlpha(myChar)) // tests if myChar is a letter
54-
{
55-
Serial.println("The character is a letter");
53+
if (isAlpha(myChar)) { // tests if myChar is a letter
54+
Serial.println("The character is a letter");
5655
}
57-
else
58-
{
59-
Serial.println("The character is not a letter");
56+
else {
57+
Serial.println("The character is not a letter");
6058
}
61-
6259
----
6360

6461
--

Language/Functions/Characters/isAlphaNumeric.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ isAlphaNumeric(thisChar)
5050

5151
[source,arduino]
5252
----
53-
if (isAlphaNumeric(myChar)) // tests if myChar isa letter or a number
54-
{
55-
Serial.println("The character is alphanumeric");
53+
if (isAlphaNumeric(myChar)) { // tests if myChar isa letter or a number
54+
Serial.println("The character is alphanumeric");
5655
}
57-
else
58-
{
59-
Serial.println("The character is not alphanumeric");
56+
else {
57+
Serial.println("The character is not alphanumeric");
6058
}
61-
6259
----
6360

6461
--

Language/Functions/Characters/isAscii.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ isAscii(thisChar)
5050

5151
[source,arduino]
5252
----
53-
if (isAscii(myChar)) // tests if myChar is an Ascii character
54-
{
55-
Serial.println("The character is Ascii");
53+
if (isAscii(myChar)) { // tests if myChar is an Ascii character
54+
Serial.println("The character is Ascii");
5655
}
57-
else
58-
{
59-
Serial.println("The character is not Ascii");
56+
else {
57+
Serial.println("The character is not Ascii");
6058
}
61-
6259
----
6360

6461
--

Language/Functions/Characters/isControl.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ isControl(thisChar)
5050

5151
[source,arduino]
5252
----
53-
if (isControl(myChar)) // tests if myChar is a control character
54-
{
55-
Serial.println("The character is a control character");
53+
if (isControl(myChar)) { // tests if myChar is a control character
54+
Serial.println("The character is a control character");
5655
}
57-
else
58-
{
59-
Serial.println("The character is not a control character");
56+
else {
57+
Serial.println("The character is not a control character");
6058
}
61-
6259
----
6360

6461
--

Language/Functions/Characters/isDigit.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ isDigit(thisChar)
5050

5151
[source,arduino]
5252
----
53-
if (isDigit(myChar)) // tests if myChar is a digit
54-
{
55-
Serial.println("The character is a number");
53+
if (isDigit(myChar)) { // tests if myChar is a digit
54+
Serial.println("The character is a number");
5655
}
57-
else
58-
{
59-
Serial.println("The character is not a number");
56+
else {
57+
Serial.println("The character is not a number");
6058
}
61-
6259
----
6360

6461
--

Language/Functions/Characters/isGraph.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ isGraph(thisChar)
5050

5151
[source,arduino]
5252
----
53-
if (isGraph(myChar)) // tests if myChar is a printable character but not a blank space.
54-
{
55-
Serial.println("The character is printable");
53+
if (isGraph(myChar)) { // tests if myChar is a printable character but not a blank space.
54+
Serial.println("The character is printable");
5655
}
57-
else
58-
{
59-
Serial.println("The character is not printable");
56+
else {
57+
Serial.println("The character is not printable");
6058
}
61-
6259
----
6360

6461
--

Language/Functions/Characters/isHexadecimalDigit.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,12 @@ isHexadecimalDigit(thisChar)
5252

5353
[source,arduino]
5454
----
55-
if (isHexadecimalDigit(myChar)) // tests if myChar is an hexadecimal digit
56-
{
57-
Serial.println("The character is an hexadecimal digit");
55+
if (isHexadecimalDigit(myChar)) { // tests if myChar is an hexadecimal digit
56+
Serial.println("The character is an hexadecimal digit");
5857
}
59-
else
60-
{
61-
Serial.println("The character is not an hexadecimal digit");
58+
else {
59+
Serial.println("The character is not an hexadecimal digit");
6260
}
63-
6461
----
6562

6663
--

Language/Functions/Characters/isLowerCase.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ isLowerCase(thisChar)
5050

5151
[source,arduino]
5252
----
53-
if (isLowerCase(myChar)) // tests if myChar is a lower case letter
54-
{
55-
Serial.println("The character is lower case");
53+
if (isLowerCase(myChar)) { // tests if myChar is a lower case letter
54+
Serial.println("The character is lower case");
5655
}
57-
else
58-
{
59-
Serial.println("The character is not lower case");
56+
else {
57+
Serial.println("The character is not lower case");
6058
}
61-
6259
----
6360

6461
--

Language/Functions/Characters/isPrintable.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ isPrintable(thisChar)
5050

5151
[source,arduino]
5252
----
53-
if (isPrintable(myChar)) // tests if myChar is printable char
54-
{
55-
Serial.println("The character is printable");
53+
if (isPrintable(myChar)) { // tests if myChar is printable char
54+
Serial.println("The character is printable");
5655
}
57-
else
58-
{
59-
Serial.println("The character is not printable");
56+
else {
57+
Serial.println("The character is not printable");
6058
}
61-
6259
----
6360

6461
--

Language/Functions/Characters/isPunct.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ isPunct(thisChar)
5050

5151
[source,arduino]
5252
----
53-
if (isPunct(myChar)) // tests if myChar is a punctuation character
54-
{
55-
Serial.println("The character is a punctuation");
53+
if (isPunct(myChar)) { // tests if myChar is a punctuation character
54+
Serial.println("The character is a punctuation");
5655
}
57-
else
58-
{
59-
Serial.println("The character is not a punctuation");
56+
else {
57+
Serial.println("The character is not a punctuation");
6058
}
61-
6259
----
6360

6461
--

Language/Functions/Characters/isSpace.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ isSpace(thisChar)
5050

5151
[source,arduino]
5252
----
53-
if (isSpace(myChar)) // tests if myChar is the space character
54-
{
55-
Serial.println("The character is a space");
53+
if (isSpace(myChar)) { // tests if myChar is the space character
54+
Serial.println("The character is a space");
5655
}
57-
else
58-
{
59-
Serial.println("The character is not a space");
56+
else {
57+
Serial.println("The character is not a space");
6058
}
61-
6259
----
6360

6461
--

Language/Functions/Characters/isUpperCase.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,12 @@ isUpperCase(thisChar)
4646

4747
[source,arduino]
4848
----
49-
if (isUpperCase(myChar)) // tests if myChar is an upper case letter
50-
{
51-
Serial.println("The character is upper case");
49+
if (isUpperCase(myChar)) { // tests if myChar is an upper case letter
50+
Serial.println("The character is upper case");
5251
}
53-
else
54-
{
55-
Serial.println("The character is not upper case");
52+
else {
53+
Serial.println("The character is not upper case");
5654
}
57-
5855
----
5956

6057
--

Language/Functions/Characters/isWhitespace.adoc

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ isWhitespace(thisChar)
5050

5151
[source,arduino]
5252
----
53-
if (isWhitespace(myChar)) // tests if myChar is a white space
54-
{
55-
Serial.println("The character is a white space");
53+
if (isWhitespace(myChar)) { // tests if myChar is a white space
54+
Serial.println("The character is a white space");
5655
}
57-
else
58-
{
59-
Serial.println("The character is not a white space");
56+
else {
57+
Serial.println("The character is not a white space");
6058
}
61-
6259
----
6360

6461
--

Language/Functions/Communication/Serial/available.adoc

+11-14
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,22 @@ The following code returns a character received through the serial port.
4141

4242
[source,arduino]
4343
----
44-
int incomingByte = 0; // for incoming serial data
44+
int incomingByte = 0; // for incoming serial data
4545
4646
void setup() {
47-
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
47+
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
4848
}
4949
5050
void loop() {
51-
52-
// reply only when you receive data:
53-
if (Serial.available() > 0) {
54-
// read the incoming byte:
55-
incomingByte = Serial.read();
56-
57-
// say what you got:
58-
Serial.print("I received: ");
59-
Serial.println(incomingByte, DEC);
60-
}
51+
// reply only when you receive data:
52+
if (Serial.available() > 0) {
53+
// read the incoming byte:
54+
incomingByte = Serial.read();
55+
56+
// say what you got:
57+
Serial.print("I received: ");
58+
Serial.println(incomingByte, DEC);
59+
}
6160
}
6261
----
6362
[%hardbreaks]
@@ -70,15 +69,13 @@ This code sends data received in one serial port of the Arduino Mega to another.
7069
void setup() {
7170
Serial.begin(9600);
7271
Serial1.begin(9600);
73-
7472
}
7573
7674
void loop() {
7775
// read from port 0, send to port 1:
7876
if (Serial.available()) {
7977
int inByte = Serial.read();
8078
Serial1.print(inByte, DEC);
81-
8279
}
8380
// read from port 1, send to port 0:
8481
if (Serial1.available()) {

0 commit comments

Comments
 (0)