- #define trig 2 #define echo 4long safe;
- long distance;long t;
- void setup(){
- pinMode(trig, OUTPUT);
- pinMode(echo, INPUT);
- pinMode(7, OUTPUT);
- pinMode(8, OUTPUT); }
- void loop(){
- digitalWrite(trig,LOW);
- delayMicroseconds(2);
- digitalWrite(trig,HIGH);
- delayMicroseconds(10);
- digitalWrite(trig,LOW);
- t=pulseIn(echo,HIGH);
- distance=t/74/2;
- safe=distance;
- if(safe<=10){
- digitalWrite(7,HIGH);
- digitalWrite(8,HIGH); }
- else{
- digitalWrite(7,LOW);
- digitalWrite(8,LOW); }}
TECH WITH IRESH .Arduino is an open-source electronics platform that has gained immense popularity for its versatility, simplicity, and accessibility. It consists of both hardware and software components, designed to facilitate the creation of interactive projects by artists, hobbyists, and professionals alike. Arduino is used robertics. The heart of Arduino is its microcontroller board. This board is equipped with a microcontroller chip ..
Thursday, October 17, 2024
Smart Blind stick
Subscribe to:
Comments (Atom)
-
#define trig 2 #define echo 4 long safe; long distance; long t; void setup(){ pinMode(trig, OUTPUT); pinMode(echo, INPUT); pin...
-
servo motor A servo motor is a rotary actuator that allows for precise control of angular position . It consists of a motor coupl...
-
ULTRASONIC SENSER WORKING... WATCH NOW : how to work ultrasonic senser...
.png)