|
int trigPin = 9; long duration; int sensorHeight = 200; void setup() pinMode(button, INPUT_PULLUP); Serial.begin(9600); void loop() digitalWrite(trigPin, HIGH); duration = pulseIn(echoPin, HIGH); distance = duration * 0.034 / 2; height = sensorHeight – distance; Serial.print(“Distance from sensor to head: “); Serial.print(“Human Height: “); delay(1000); |