#define BLYNK_AUTH_TOKEN "UsEGtNTvBSVEkTRXua8w2KfkInmlh4ng"
#define BLYNK_TEMPLATE_ID "TMPL3lqA3JunR"
#define BLYNK_TEMPLATE_NAME "Navigation assistant for virtually impaired indivi"
#define BLYNK_AUTH_TOKEN "Your Auth Token"
const int trigPin = 9;
const int echoPin = 10;
const int buzzer = 6;
// defines variables
long duration;
int distance;
int safetyDistance;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
pinMode(buzzer, OUTPUT);
safetyDistance = 100;
tone(buzzer, 2500);
delay(500);
tone (buzzer, 2500);
Serial.begin(9600); // Starts the serial communication
}
void loop() {
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
int beep = map (distance, 0, 3000, 0, 10000);
int time1 = map (distance, 0, 3000, 0, 300);
tone(buzzer, beep, time1);
delay(time1);
noTone (buzzer);
}