1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-18 07:52:14 +01:00

Auto Format all built-in examples

The only changes I left out are the Max/MSP patches because I don't know whether the indentation would break them.
This commit is contained in:
per1234 2017-07-14 15:35:58 -07:00 committed by Cristian Maglie
parent 8f48433f33
commit eee3e5ba18
72 changed files with 128 additions and 128 deletions

View File

@ -3,7 +3,7 @@
Reads a digital input on pin 2, prints the result to the Serial Monitor
This example code is in the public domain.
*/
*/
// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 2;

View File

@ -11,7 +11,7 @@
a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
This example code is in the public domain.
*/
*/
int led = 9; // the PWM pin the LED is attached to
int brightness = 0; // how bright the LED is

View File

@ -25,7 +25,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
*/
*/
// constants won't change. Used here to set a pin number:
const int ledPin = LED_BUILTIN;// the number of the LED pin

View File

@ -22,7 +22,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Button
*/
*/
// constants won't change. They're used here to
// set pin numbers:

View File

@ -28,7 +28,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Debounce
*/
*/
// constants won't change. They're used here to
// set pin numbers:

View File

@ -19,7 +19,7 @@
This example code is in the public domain
*/
*/
void setup() {
//start serial connection

View File

@ -23,7 +23,7 @@
http://www.arduino.cc/en/Tutorial/ButtonStateChange
*/
*/
// this constant won't change:
const int buttonPin = 2; // the pin that the pushbutton is attached to

View File

@ -16,7 +16,7 @@
http://www.arduino.cc/en/Tutorial/Tone3
*/
*/
#include "pitches.h"

View File

@ -14,7 +14,7 @@
http://www.arduino.cc/en/Tutorial/Tone
*/
*/
#include "pitches.h"
// notes in the melody:

View File

@ -14,7 +14,7 @@
http://www.arduino.cc/en/Tutorial/Tone4
*/
*/
void setup() {

View File

@ -16,7 +16,7 @@
http://www.arduino.cc/en/Tutorial/Tone2
*/
*/
void setup() {

View File

@ -17,7 +17,7 @@
This example code is in the public domain.
*/
*/
// These constants won't change. They're used to give names
// to the pins used:

View File

@ -25,7 +25,7 @@
http://www.arduino.cc/en/Tutorial/AnalogInput
*/
*/
int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED

View File

@ -12,7 +12,7 @@
This example code is in the public domain.
*/
*/
// These constants won't change. They're used to give names
// to the pins used:
const int lowestPin = 2;

View File

@ -24,7 +24,7 @@
This example code is in the public domain.
*/
*/
// These constants won't change:
const int sensorPin = A0; // pin that the sensor is attached to

View File

@ -15,7 +15,7 @@
This example code is in the public domain.
*/
*/
int ledPin = 9; // LED connected to digital pin 9

View File

@ -18,7 +18,7 @@
<http://www.zambetti.com>
*/
*/
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);

View File

@ -19,7 +19,7 @@
http://www.arduino.cc/en/Tutorial/Dimmer
*/
*/
const int ledPin = 9; // the pin that the LED is attached to
@ -80,7 +80,7 @@ void loop() {
// a single byte
port.write(mouseX);
}
*/
*/
/* Max/MSP v5 patch for this example

View File

@ -24,7 +24,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Graph
*/
*/
void setup() {
// initialize the serial communication:

View File

@ -20,7 +20,7 @@
http://www.arduino.cc/en/Tutorial/Midi
*/
*/
void setup() {
// Set MIDI baud rate:

View File

@ -18,7 +18,7 @@
This example code is in the public domain.
*/
*/
void setup() {

View File

@ -21,7 +21,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/PhysicalPixel
*/
*/
const int ledPin = 13; // the pin that the LED is attached to
int incomingByte; // a variable to read incoming serial data into
@ -121,7 +121,7 @@ void loop() {
}
*/
*/
/*
Max/MSP version 5 patch to run with this example:

View File

@ -18,7 +18,7 @@
by Arturo Guadalupi
This example code is in the public domain.
*/
*/
// pins for the LEDs:
const int redPin = 3;

View File

@ -22,7 +22,7 @@
http://www.arduino.cc/en/Tutorial/SerialCallResponse
*/
*/
int firstSensor = 0; // first analog sensor
int secondSensor = 0; // second analog sensor

View File

@ -26,7 +26,7 @@
http://www.arduino.cc/en/Tutorial/SerialCallResponseASCII
*/
*/
int firstSensor = 0; // first analog sensor
int secondSensor = 0; // second analog sensor

View File

@ -18,7 +18,7 @@
http://www.arduino.cc/en/Tutorial/SerialEvent
*/
*/
String inputString = ""; // a String to hold incoming data
boolean stringComplete = false; // whether the string is complete
@ -45,7 +45,7 @@ void loop() {
hardware serial RX. This routine is run between each
time loop() runs, so using delay inside loop can delay
response. Multiple bytes of data may be available.
*/
*/
void serialEvent() {
while (Serial.available()) {
// get the new byte:

View File

@ -14,7 +14,7 @@
by Tom Igoe and Scott Fitzgerald
This example code is in the public domain.
*/
*/
const int redPin = A0; // sensor to control red color
const int greenPin = A1; // sensor to control green color
@ -86,7 +86,7 @@ void loop() {
}
}
*/
*/
/* Max/MSP patch for this example

View File

@ -19,7 +19,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Array
*/
*/
int timer = 100; // The higher the number, the slower the timing.
int ledPins[] = {

View File

@ -15,7 +15,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/ForLoop
*/
*/
int timer = 100; // The higher the number, the slower the timing.

View File

@ -23,7 +23,7 @@
http://www.arduino.cc/en/Tutorial/IfStatement
*/
*/
// These constants won't change:
const int analogPin = A0; // pin that the sensor is attached to

View File

@ -26,7 +26,7 @@
http://www.arduino.cc/en/Tutorial/WhileLoop
*/
*/
// These constants won't change:

View File

@ -20,7 +20,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/SwitchCase
*/
*/
// these constants won't change. They are the
// lowest and highest readings you get from your sensor:

View File

@ -18,7 +18,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/SwitchCase2
*/
*/
void setup() {
// initialize serial communication:

View File

@ -19,7 +19,7 @@
This example code is in the public domain.
*/
*/
// these constants won't change:

View File

@ -21,7 +21,7 @@
This example code is in the public domain.
*/
*/
// these constants won't change:
const int xPin = 2; // X output of the accelerometer

View File

@ -20,7 +20,7 @@
This example code is in the public domain.
*/
*/
// this constant won't change. It's the pin number
// of the sensor's output:

View File

@ -31,7 +31,7 @@
http://www.arduino.cc/en/Tutorial/RowColumnScanning
see also http://www.tigoe.net/pcomp/code/category/arduinowiring/514 for more
*/
*/
// 2-dimensional array of row pin numbers:

View File

@ -18,7 +18,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/BarGraph
*/
*/
// these constants won't change:

View File

@ -9,7 +9,7 @@
by Tom Igoe
This example code is in the public domain.
*/
*/
void setup() {
// Open serial communications and wait for port to open:

View File

@ -11,7 +11,7 @@
http://www.arduino.cc/en/Tutorial/StringAdditionOperator
This example code is in the public domain.
*/
*/
// declare three Strings:
String stringOne, stringTwo, stringThree;

View File

@ -10,7 +10,7 @@
http://www.arduino.cc/en/Tutorial/StringAppendOperator
This example code is in the public domain.
*/
*/
String stringOne, stringTwo;

View File

@ -10,7 +10,7 @@
http://www.arduino.cc/en/Tutorial/StringCaseChanges
This example code is in the public domain.
*/
*/
void setup() {
// Open serial communications and wait for port to open:

View File

@ -10,7 +10,7 @@
http://www.arduino.cc/en/Tutorial/StringCharacters
This example code is in the public domain.
*/
*/
void setup() {
// Open serial communications and wait for port to open:

View File

@ -10,7 +10,7 @@
http://www.arduino.cc/en/Tutorial/StringComparisonOperators
This example code is in the public domain.
*/
*/
String stringOne, stringTwo;

View File

@ -10,7 +10,7 @@
http://www.arduino.cc/en/Tutorial/StringConstructors
This example code is in the public domain.
*/
*/
void setup() {
// Open serial communications and wait for port to open:

View File

@ -10,7 +10,7 @@
http://www.arduino.cc/en/Tutorial/StringIndexOf
This example code is in the public domain.
*/
*/
void setup() {
// Open serial communications and wait for port to open:

View File

@ -10,7 +10,7 @@
http://www.arduino.cc/en/Tutorial/StringLengthTrim
This example code is in the public domain.
*/
*/
String txtMsg = ""; // a string for incoming text
unsigned int lastStringLength = txtMsg.length(); // previous length of the String

View File

@ -10,7 +10,7 @@
http://www.arduino.cc/en/Tutorial/StringLengthTrim
This example code is in the public domain.
*/
*/
void setup() {
// Open serial communications and wait for port to open:

View File

@ -10,7 +10,7 @@
http://www.arduino.cc/en/Tutorial/StringReplace
This example code is in the public domain.
*/
*/
void setup() {
// Open serial communications and wait for port to open:

View File

@ -10,7 +10,7 @@
http://www.arduino.cc/en/Tutorial/StringStartsWithEndsWith
This example code is in the public domain.
*/
*/
void setup() {
// Open serial communications and wait for port to open:

View File

@ -10,7 +10,7 @@
http://www.arduino.cc/en/Tutorial/StringSubstring
This example code is in the public domain.
*/
*/
void setup() {
// Open serial communications and wait for port to open:

View File

@ -11,7 +11,7 @@
by Tom Igoe
This example code is in the public domain.
*/
*/
String inString = ""; // string to hold input

View File

@ -23,7 +23,7 @@
This example is in the public domain
http://www.arduino.cc/en/Tutorial/KeyboardLogout
*/
*/
#define OSX 0
#define WINDOWS 1

View File

@ -18,7 +18,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/KeyboardMessage
*/
*/
#include "Keyboard.h"

View File

@ -25,7 +25,7 @@
This example is in the public domain
http://www.arduino.cc/en/Tutorial/KeyboardReprogram
*/
*/
#include "Keyboard.h"

View File

@ -17,7 +17,7 @@
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/KeyboardSerial
*/
*/
#include "Keyboard.h"

View File

@ -19,7 +19,7 @@
this code is in the public domain
*/
*/
#include "Keyboard.h"
#include "Mouse.h"

View File

@ -22,7 +22,7 @@
this code is in the public domain
*/
*/
#include "Mouse.h"

View File

@ -26,7 +26,7 @@
this code is in the public domain
*/
*/
#include "Mouse.h"
@ -98,7 +98,7 @@ void loop() {
/*
reads an axis (0 or 1 for x or y) and scales the
analog input range to a range from 0 to <range>
*/
*/
int readAxis(int thisAxis) {
// read the analog input:

View File

@ -16,7 +16,7 @@
http://www.arduino.cc/starterKit
This example code is part of the public domain
*/
*/
// named constant for the pin the sensor is connected to
const int sensorPin = A0;

View File

@ -20,7 +20,7 @@
http://www.arduino.cc/starterKit
This example code is part of the public domain
*/
*/
const int greenLEDPin = 9; // LED connected to digital pin 9
const int redLEDPin = 10; // LED connected to digital pin 10

View File

@ -16,7 +16,7 @@
http://www.arduino.cc/starterKit
This example code is part of the public domain
*/
*/
// include the Servo library
#include <Servo.h>

View File

@ -17,7 +17,7 @@
http://www.arduino.cc/starterKit
This example code is part of the public domain
*/
*/
// named constant for the switch pin
const int switchPin = 8;

View File

@ -19,7 +19,7 @@
http://www.arduino.cc/starterKit
This example code is part of the public domain
*/
*/
// named constants for the switch and motor pins
const int switchPin = 2; // the number of the switch pin

View File

@ -20,7 +20,7 @@
http://www.arduino.cc/starterKit
This example code is part of the public domain
*/
*/
const int controlPin1 = 2; // connected to pin 7 on the H-bridge
const int controlPin2 = 3; // connected to pin 2 on the H-bridge

View File

@ -19,7 +19,7 @@
http://www.arduino.cc/starterKit
This example code is part of the public domain
*/
*/
// include the library code:
#include <LiquidCrystal.h>

View File

@ -24,7 +24,7 @@
http://www.arduino.cc/starterKit
This example code is part of the public domain
*/
*/
// import the library
#include <Servo.h>

View File

@ -21,7 +21,7 @@
http://www.arduino.cc/starterKit
This example code is part of the public domain
*/
*/
// import the library (must be located in the
// Arduino/libraries directory)

View File

@ -18,7 +18,7 @@
http://www.arduino.cc/starterKit
This example code is part of the public domain
*/
*/
void setup() {
@ -99,4 +99,4 @@ void loop() {
// draw the Arduino logo
image(logo, 0, 0);
}
*/
*/

View File

@ -16,7 +16,7 @@
http://www.arduino.cc/starterKit
This example code is part of the public domain
*/
*/
const int optoPin = 2; // the pin the optocoupler is connected to

View File

@ -166,21 +166,21 @@ void pulse(int pin, int times);
#define SPI_MODE0 0x00
class SPISettings {
public:
public:
// clock is in Hz
SPISettings(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) : clock(clock){
SPISettings(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) : clock(clock) {
(void) bitOrder;
(void) dataMode;
};
private:
private:
uint32_t clock;
friend class BitBangedSPI;
friend class BitBangedSPI;
};
class BitBangedSPI {
public:
public:
void begin() {
digitalWrite(PIN_SCK, LOW);
digitalWrite(PIN_MOSI, LOW);
@ -209,7 +209,7 @@ public:
return b;
}
private:
private:
unsigned long pulseWidth; // in microseconds
};