Tell us about yourself!

Complete Your Profile
  • DianaM104 commented on DIYmechanics's instructable Diy Smart Blind Stick Using Arduino2 years ago
    Diy Smart Blind Stick Using Arduino

    try this code...#define trigPin 13#define echoPin 12#define motor 7#define buzzer 6void setup(){ pinMode(trigPin, OUTPUT);pinMode(echoPin, INPUT);pinMode(motor, OUTPUT);pinMode(buzzer,OUTPUT);}void loop(){long duration, distance;digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH);delayMicroseconds(10); digitalWrite(trigPin, LOW);duration = pulseIn(echoPin, HIGH);distance = (duration/2) / 29.1;if (distance < 70)// This is where checking the distanceyou can change the value{ digitalWrite(motor,HIGH); // When the the distance below 100cmdigitalWrite(buzzer,HIGH);} else{digitalWrite(motor,LOW);// when greater than 100cmdigitalWrite(buzzer,LOW); } delay(500);}

    View Instructable »