mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Run new astyle formatter against all the examples
This commit is contained in:
@ -1,23 +1,23 @@
|
||||
/* Ping))) Sensor
|
||||
|
||||
|
||||
This sketch reads a PING))) ultrasonic rangefinder and returns the
|
||||
distance to the closest object in range. To do this, it sends a pulse
|
||||
to the sensor to initiate a reading, then listens for a pulse
|
||||
to return. The length of the returning pulse is proportional to
|
||||
to the sensor to initiate a reading, then listens for a pulse
|
||||
to return. The length of the returning pulse is proportional to
|
||||
the distance of the object from the sensor.
|
||||
|
||||
|
||||
The circuit:
|
||||
* +V connection of the PING))) attached to +5V
|
||||
* GND connection of the PING))) attached to ground
|
||||
* SIG connection of the PING))) attached to digital pin 7
|
||||
|
||||
http://www.arduino.cc/en/Tutorial/Ping
|
||||
|
||||
|
||||
created 3 Nov 2008
|
||||
by David A. Mellis
|
||||
modified 30 Aug 2011
|
||||
by Tom Igoe
|
||||
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
*/
|
||||
@ -33,7 +33,7 @@ void setup() {
|
||||
|
||||
void loop()
|
||||
{
|
||||
// establish variables for duration of the ping,
|
||||
// establish variables for duration of the ping,
|
||||
// and the distance result in inches and centimeters:
|
||||
long duration, inches, cm;
|
||||
|
||||
@ -55,13 +55,13 @@ void loop()
|
||||
// convert the time into a distance
|
||||
inches = microsecondsToInches(duration);
|
||||
cm = microsecondsToCentimeters(duration);
|
||||
|
||||
|
||||
Serial.print(inches);
|
||||
Serial.print("in, ");
|
||||
Serial.print(cm);
|
||||
Serial.print("cm");
|
||||
Serial.println();
|
||||
|
||||
|
||||
delay(100);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user