for this week i have been working on how to measure and detect the distance using the arduino and ultrasound and build an application
so here the coding :
#define trigPin 5
#define echoPin 4
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
float duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration / 2) * 0.0344;
if (distance >= 400 || distance <= 2){
Serial.print("Distance = ");
Serial.println("Out of range");
}
else {
Serial.print("Distance = ");
Serial.print(distance);
Serial.println(" cm");
delay(500);
}
delay(500);
}
from the coding it will display the distance between ultrasonic sensor and the obstacales
for the application , i decided to use another android inventor at first which is App Inventor 2 through online. I have design on how the apps will be connected through the bluetooth .
this figure is suppose show how on the apps will be looked on the simulation.We just have to connect and pair the device and ultrasonic sensor..
The coding of the apps is set as below
but unfortunately , after the coding has been constructed and when come the time to stimulate it , the installer itself cannot be done .
For the design ,I have bought a wrist band for an athlete as a base to put all the component
but as i look on this wrist band i thought that it might be a difficulty for the user so i design it more friendly user so then it becomes like this
i design the wrist band to be more wearable to the blind people .
I also include some velcro in order so in can be adjustable to the size of the wrist for different user .





No comments:
Post a Comment