Victor Vasconcelos Viana
Published

Obstacle Sensor for the Visually Impaired

A simple aid for the visually impaired.

BeginnerShowcase (no instructions)1 hour1,800
Obstacle Sensor for the Visually Impaired

Things used in this project

Schematics

How to build

Code

Obstacle detector code

C/C++
int const trigPin = 10;
int const echoPin = 9;
int const buzzPin = 2;
void setup() {
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(buzzPin, OUTPUT);
}
void loop() {
  int duration, distance;
  digitalWrite(trigPin, HIGH); 
  delay(1);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;
    if (distance <= 50 && distance >= 0) {
      digitalWrite(buzzPin, HIGH);
    } else {
      digitalWrite(buzzPin, LOW);
    }
    delay(60);

}

Credits

Victor Vasconcelos Viana

Victor Vasconcelos Viana

1 project • 0 followers

Comments