mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-23 19:21:59 +03:00
Run new astyle formatter against all the examples
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
/*
|
||||
Analog Input
|
||||
Demonstrates analog input by reading an analog sensor on analog pin 0 and
|
||||
turning on and off a light emitting diode(LED) connected to digital pin 13.
|
||||
turning on and off a light emitting diode(LED) connected to digital pin 13.
|
||||
The amount of time the LED will be on and off depends on
|
||||
the value obtained by analogRead().
|
||||
|
||||
the value obtained by analogRead().
|
||||
|
||||
The circuit:
|
||||
* Potentiometer attached to analog input 0
|
||||
* center pin of the potentiometer to the analog pin
|
||||
@ -12,19 +12,19 @@
|
||||
* the other side pin to +5V
|
||||
* LED anode (long leg) attached to digital output 13
|
||||
* LED cathode (short leg) attached to ground
|
||||
|
||||
* Note: because most Arduinos have a built-in LED attached
|
||||
|
||||
* Note: because most Arduinos have a built-in LED attached
|
||||
to pin 13 on the board, the LED is optional.
|
||||
|
||||
|
||||
|
||||
|
||||
Created by David Cuartielles
|
||||
modified 30 Aug 2011
|
||||
By Tom Igoe
|
||||
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
|
||||
http://arduino.cc/en/Tutorial/AnalogInput
|
||||
|
||||
|
||||
*/
|
||||
|
||||
int sensorPin = A0; // select the input pin for the potentiometer
|
||||
@ -33,18 +33,18 @@ int sensorValue = 0; // variable to store the value coming from the sensor
|
||||
|
||||
void setup() {
|
||||
// declare the ledPin as an OUTPUT:
|
||||
pinMode(ledPin, OUTPUT);
|
||||
pinMode(ledPin, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// read the value from the sensor:
|
||||
sensorValue = analogRead(sensorPin);
|
||||
sensorValue = analogRead(sensorPin);
|
||||
// turn the ledPin on
|
||||
digitalWrite(ledPin, HIGH);
|
||||
digitalWrite(ledPin, HIGH);
|
||||
// stop the program for <sensorValue> milliseconds:
|
||||
delay(sensorValue);
|
||||
// turn the ledPin off:
|
||||
digitalWrite(ledPin, LOW);
|
||||
delay(sensorValue);
|
||||
// turn the ledPin off:
|
||||
digitalWrite(ledPin, LOW);
|
||||
// stop the program for for <sensorValue> milliseconds:
|
||||
delay(sensorValue);
|
||||
delay(sensorValue);
|
||||
}
|
Reference in New Issue
Block a user