Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Andres Duarte
Created November 30, 2015

Distance measuring sensor

Protip152
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
14 projects • 8 followers
Contact

Comments

Please log in or sign up to comment.