Skip to content

Commit 5e98cd8

Browse files
author
Federico Fissore
committed
Examples: mass code format. See example_formatter.conf
1 parent 1af21b2 commit 5e98cd8

File tree

136 files changed

+1377
-1467
lines changed

Some content is hidden

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

136 files changed

+1377
-1467
lines changed

build/shared/examples/02.Digital/BlinkWithoutDelay/BlinkWithoutDelay.ino

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
* LED attached from pin 13 to ground.
99
* Note: on most Arduinos, there is already an LED on the board
1010
that's attached to pin 13, so no hardware is needed for this example.
11-
11+
1212
created 2005
1313
by David A. Mellis
1414
modified 8 Feb 2010
1515
by Paul Stoffregen
1616
modified 11 Nov 2013
1717
by Scott Fitzgerald
18-
19-
18+
19+
2020
This example code is in the public domain.
21-
21+
2222
http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
2323
*/
2424

@@ -40,25 +40,25 @@ void setup() {
4040
pinMode(ledPin, OUTPUT);
4141
}
4242

43-
void loop()
44-
{
43+
void loop() {
4544
// here is where you'd put code that needs to be running all the time.
4645

4746
// check to see if it's time to blink the LED; that is, if the
4847
// difference between the current time and last time you blinked
4948
// the LED is bigger than the interval at which you want to
5049
// blink the LED.
5150
unsigned long currentMillis = millis();
52-
53-
if(currentMillis - previousMillis >= interval) {
54-
// save the last time you blinked the LED
55-
previousMillis = currentMillis;
51+
52+
if (currentMillis - previousMillis >= interval) {
53+
// save the last time you blinked the LED
54+
previousMillis = currentMillis;
5655

5756
// if the LED is off turn it on and vice-versa:
58-
if (ledState == LOW)
57+
if (ledState == LOW) {
5958
ledState = HIGH;
60-
else
59+
} else {
6160
ledState = LOW;
61+
}
6262

6363
// set the LED with the ledState of the variable:
6464
digitalWrite(ledPin, ledState);

build/shared/examples/02.Digital/Button/Button.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ void loop() {
4848
if (buttonState == HIGH) {
4949
// turn LED on:
5050
digitalWrite(ledPin, HIGH);
51-
}
52-
else {
51+
} else {
5352
// turn LED off:
5453
digitalWrite(ledPin, LOW);
5554
}

build/shared/examples/02.Digital/DigitalInputPullup/DigitalInputPullup.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ void loop() {
4242
// button's pressed, and off when it's not:
4343
if (sensorVal == HIGH) {
4444
digitalWrite(13, LOW);
45-
}
46-
else {
45+
} else {
4746
digitalWrite(13, HIGH);
4847
}
4948
}

build/shared/examples/02.Digital/StateChangeDetection/StateChangeDetection.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ void loop() {
5858
Serial.println("on");
5959
Serial.print("number of button pushes: ");
6060
Serial.println(buttonPushCounter);
61-
}
62-
else {
61+
} else {
6362
// if the current state is LOW then the button
6463
// wend from on to off:
6564
Serial.println("off");

build/shared/examples/03.Analog/AnalogInOutSerial/AnalogInOutSerial.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void loop() {
4141
analogWrite(analogOutPin, outputValue);
4242

4343
// print the results to the serial monitor:
44-
Serial.print("sensor = " );
44+
Serial.print("sensor = ");
4545
Serial.print(sensorValue);
4646
Serial.print("\t output = ");
4747
Serial.println(outputValue);

build/shared/examples/03.Analog/Smoothing/Smoothing.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ int average = 0; // the average
3434

3535
int inputPin = A0;
3636

37-
void setup()
38-
{
37+
void setup() {
3938
// initialize serial communication with computer:
4039
Serial.begin(9600);
4140
// initialize all the readings to 0:
42-
for (int thisReading = 0; thisReading < numReadings; thisReading++)
41+
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
4342
readings[thisReading] = 0;
43+
}
4444
}
4545

4646
void loop() {
@@ -54,9 +54,10 @@ void loop() {
5454
readIndex = readIndex + 1;
5555

5656
// if we're at the end of the array...
57-
if (readIndex >= numReadings)
57+
if (readIndex >= numReadings) {
5858
// ...wrap around to the beginning:
5959
readIndex = 0;
60+
}
6061

6162
// calculate the average:
6263
average = total / numReadings;

build/shared/examples/04.Communication/Dimmer/Dimmer.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323

2424
const int ledPin = 9; // the pin that the LED is attached to
2525

26-
void setup()
27-
{
26+
void setup() {
2827
// initialize the serial communication:
2928
Serial.begin(9600);
3029
// initialize the ledPin as an output:

build/shared/examples/04.Communication/Graph/Graph.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ void loop() {
6565
// List all the available serial ports
6666
// if using Processing 2.1 or later, use Serial.printArray()
6767
println(Serial.list());
68-
68+
6969
// I know that the first port in the serial list on my mac
7070
// is always my Arduino, so I open Serial.list()[0].
7171
// Open whatever port is the one you're using.
7272
myPort = new Serial(this, Serial.list()[0], 9600);
73-
73+
7474
// don't generate a serialEvent() unless you get a newline character:
7575
myPort.bufferUntil('\n');
76-
76+
7777
// set inital background:
7878
background(0);
7979
}

build/shared/examples/04.Communication/PhysicalPixel/PhysicalPixel.ino

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,19 @@ void loop() {
7878
size(200, 200);
7979
boxX = width/2.0;
8080
boxY = height/2.0;
81-
rectMode(RADIUS);
82-
83-
// List all the available serial ports in the output pane.
84-
// You will need to choose the port that the Arduino board is
85-
// connected to from this list. The first port in the list is
86-
// port #0 and the third port in the list is port #2.
81+
rectMode(RADIUS);
82+
83+
// List all the available serial ports in the output pane.
84+
// You will need to choose the port that the Arduino board is
85+
// connected to from this list. The first port in the list is
86+
// port #0 and the third port in the list is port #2.
8787
// if using Processing 2.1 or later, use Serial.printArray()
88-
println(Serial.list());
89-
90-
// Open the port that the Arduino board is connected to (in this case #0)
91-
// Make sure to open the port at the same speed Arduino is using (9600bps)
92-
port = new Serial(this, Serial.list()[0], 9600);
93-
88+
println(Serial.list());
89+
90+
// Open the port that the Arduino board is connected to (in this case #0)
91+
// Make sure to open the port at the same speed Arduino is using (9600bps)
92+
port = new Serial(this, Serial.list()[0], 9600);
93+
9494
}
9595
9696
void draw()

build/shared/examples/04.Communication/SerialCallResponse/SerialCallResponse.ino

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ int secondSensor = 0; // second analog sensor
2929
int thirdSensor = 0; // digital sensor
3030
int inByte = 0; // incoming serial byte
3131

32-
void setup()
33-
{
32+
void setup() {
3433
// start serial port at 9600 bps:
3534
Serial.begin(9600);
3635
while (!Serial) {
@@ -41,8 +40,7 @@ void setup()
4140
establishContact(); // send a byte to establish contact until receiver responds
4241
}
4342

44-
void loop()
45-
{
43+
void loop() {
4644
// if we get a valid byte, read analog ins:
4745
if (Serial.available() > 0) {
4846
// get incoming byte:

0 commit comments

Comments
 (0)