Go Down

Topic: [HELP] Interfacing HCSR04 to VB.NET (Read 499 times) previous topic - next topic

KenzeroPH

I am creating a Parking System. I use Ultrasonic Sensor to sense if there is a Car Parked to a Parking Slot.

Here is my Arduino Sketch.

Code: [Select]

#define trigPin 3
#define echoPin 2

void setup() {
 Serial.begin (9600);
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
}

void loop() {
 int duration, distance;
 digitalWrite(trigPin, HIGH);
 delayMicroseconds(1000);
 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH);
 distance = (duration/2) / 29.1;
 Serial.print(distance);
 Serial.println(" cm");
 delay(100);
}


How can I read the Distance Values for VB.NET. I really need Help . THANK YOU .

KenzeroPH


Go Up