This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 | |
the distance of the object from the sensor. | |
The circuit: | |
* +V connection of the PING))) attached to +5V |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long previousMillis = 0; // store last time LED was updated | |
long interval = 100; // blink interval (milliseconds) | |
void setup() { | |
pinMode(2, INPUT); | |
pinMode(3, OUTPUT); | |
pinMode(4, OUTPUT); | |
digitalWrite(4, HIGH); // start with one LED on |
NewerOlder