Search This Blog

Monday, 23 November 2020

smart glove for blinds

Code for the Arduino nano
#define trigPin 13


#define echoPin 12


#define motor 7


#define buzzer 6


void 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 distance you can change the value


{


digitalWrite(motor,HIGH);    // When the the distance below 100cm


digitalWrite(buzzer,HIGH);


} else


{


digitalWrite(motor,LOW);     // when greater than 100cm


digitalWrite(buzzer,LOW);


} delay(500);


}

               circuit diagramπŸ”πŸ‘†πŸ‘†πŸ‘†



No comments:

Post a Comment

interfacing ph sensor with arduino

You will need to connect the pH sensor to the Arduino board and configure the pins accordingly. Refer to the documentation of your pH se...