Andres Duarte
Created November 30, 2015

Distance measuring sensor

Protip150
Distance measuring sensor

Things used in this project

Story

Read more

Schematics

schematic

Code

sensor

Arduino
int sensorpin = 0;                 // analog pin used to connectsensor
int val = 0;                 // variable storesvalues from sensor

void setup()
{
  Serial.begin(9600);               // starts the serial monitor
}
 
void loop()
{
  val = analogRead(sensorpin);       // reads the value  of sensor
  Serial.println(val);            // prints the value of the sensor to the serial monitor
  delay(100);                     
}

sensor

Arduino
No preview (download only).

Credits

Andres Duarte

Andres Duarte

14 projects • 8 followers

Comments