Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
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
14 projects • 8 followers

Comments