Abstract: Abstract Corona Virus Pandemic has emphasized the requirement to accelerate the companies, especially in healthcare to adopt automation. Countless healthcare profesionals have risked and are currently risking and may continue to risk their precious lives, while tending the dependents. Two Phases of Corona Virus infections have disturbed the lives of people in general and health care professionals in particular. The third phase i.e. the delta phase may be imminent and can even affect kids. In this regard, an invention was made named as “AutoSanitBot.” This is an ambulatory robotic based sanitizer that would replace only the risky task of health care professionals like “Automatically sanitizing the sensitive hospital areas. This will avoid the physical contact of person going almost every place in the hospital for cleaning and sanitizing.
1. Used the current version of Arduino
2. Arduino programs to operate the AutoSanitBot Robot
3. The Universal Automaton used to construct the AutoSanitBot Robot Arduino programs #define CW 3 //CW is defined as pin #7// #define CCW 4 //CCW is defined as pin #8// #define CW9 9 //CW is defined as pin #7// #define CW10 10 //CCW is defined as pin #8// #define CW11 11 //CW is defined as pin #7// #define CW12 12 //CCW is defined as pin #8// #define CW5 5 //CW is defined as pin #7// #define CW6 6 //CCW is defined as pin #8// #define echoPin 7 // attach pin D2 Arduino to pin Echo of HC-SR04 #define trigPin 8 //attach pin D3 Arduino to pin Trig of HC-SR04 long duration; // variable for the duration of sound wave travel int distance; // variable for the distance measurement void setup() { //Setup runs once// pinMode(CW, OUTPUT); //Set CW as an output// pinMode(CCW, OUTPUT); //Set CCW as an output// pinMode(CW9, OUTPUT); //Set CW as an output// pinMode(CW10, OUTPUT); //Set CCW as an output// pinMode(CW11, OUTPUT); //Set CW as an output// pinMode(CW12, OUTPUT); //Set CCW as an output// pinMode(CW5, OUTPUT); //Set CW as an output// pinMode(CW6, OUTPUT); //Set CCW as an output// pinMode(trigPin, OUTPUT); // Sets the trigPin as an OUTPUT pinMode(echoPin, INPUT); // Sets the echoPin as an INPUT Serial.begin(9600); // // Serial Communication is starting with 9600 of baudrate speed Serial.println("Ultrasonic Sensor HC-SR04 Test"); // print some text in Serial Monitor Serial.println("with Arduino UNO R3"); } void loop() { //Loop runs forever// digitalWrite(trigPin, LOW); delay(250); digitalWrite(trigPin, HIGH); delay(250); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = duration * 0.034 / 2; // Speed of sound wave divided by 2 (go and back) Serial.print("Distance: "); delay(250); Serial.print(distance); Serial.println(" cm"); digitalWrite(CW,LOW); //INITIALIZE Motor // digitalWrite(CCW,LOW); digitalWrite(CW9,LOW); digitalWrite(CW10,LOW); digitalWrite(CW11,LOW); digitalWrite(CW12,LOW); digitalWrite(CW5,LOW); digitalWrite(CW6,LOW); delay(250); //for 1 second// if (distance < 10 && distance > 0) { digitalWrite(CW,HIGH); //Motor runs clockwise// digitalWrite(CCW,LOW); //Motor runs clockwise// digitalWrite(CW9,HIGH); //Motor runs clockwise// digitalWrite(CW10,LOW); //Motor runs clockwise// digitalWrite(CW11,HIGH); //Motor runs clockwise// digitalWrite(CW12,LOW); //Motor runs clockwise// digitalWrite(CW5,HIGH); //Motor runs clockwise// digitalWrite(CW6,LOW); //Motor runs clockwise// delay(500); //for 1 second// digitalWrite(CW,LOW); //Motor runs clockwise// digitalWrite(CCW,LOW); //Motor runs clockwise// digitalWrite(CW9,LOW); //Motor runs clockwise// digitalWrite(CW10,LOW); //Motor runs clockwise// digitalWrite(CW11,LOW); //Motor runs clockwise// digitalWrite(CW12,LOW); //Motor runs clockwise// digitalWrite(CW5,LOW); //Motor runs clockwise// digitalWrite(CW6,LOW); //Motor runs clockwise// Serial.print("waiting: "); delay(250); //for 1 second// digitalWrite(CW, LOW); //Motor stops// digitalWrite(CCW, HIGH);//Motor runs counter-clockwise// digitalWrite(CW9, LOW); //Motor stops// digitalWrite(CW10, HIGH);//Motor runs counter-clockwise// digitalWrite(CW11, LOW); //Motor stops// digitalWrite(CW12, HIGH);//Motor runs counter-clockwise// digitalWrite(CW5, LOW); //Motor stops// digitalWrite(CW6, HIGH);//Motor runs counter-clockwise// delay(500); //For 1 second// digitalWrite(CW,LOW); //Motor runs clockwise// digitalWrite(CCW,LOW); //Motor runs clockwise// digitalWrite(CW9,LOW); //Motor runs clockwise// digitalWrite(CW10,LOW); //Motor runs clockwise// digitalWrite(CW11,LOW); //Motor runs clockwise// digitalWrite(CW12,LOW); //Motor runs clockwise// digitalWrite(CW5,LOW); //Motor runs clockwise// digitalWrite(CW6,LOW); //Motor runs clockwise// Serial.print("waiting: "); delay(250); } } #define IN1 11 #define IN2 10 #define IN3 9 #define IN4 8 int Steps = 0; boolean Direction = true;// unsigned long last_time; unsigned long currentMillis ; int steps_left = 4095; long time; void setup() { Serial.begin(9600); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); } void loop() { while (steps_left > 0) { currentMillis = micros(); if (currentMillis - last_time >= 1000) { stepper(1); time = time + micros() - last_time; last_time = micros(); steps_left--; } } Serial.println(time); Serial.println("Wait...!"); delay(2000); Direction = !Direction; steps_left = 4095; } void stepper(int xw) { for (int x = 0; x < xw; x++) { switch (Steps) { case 0: digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4, HIGH); Serial.println(0); delay(10); break; case 1: digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); digitalWrite(IN3, HIGH); digitalWrite(IN4, HIGH); Serial.println(1); delay(10); break; case 2: digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); Serial.println(2); delay(10); break; case 3: digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH); digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); Serial.println(3); delay(10); break; case 4: digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH); digitalWrite(IN3, LOW); digitalWrite(IN4, LOW); Serial.println(4); delay(10); break; case 5: digitalWrite(IN1, HIGH); digitalWrite(IN2, HIGH); digitalWrite(IN3, LOW); digitalWrite(IN4, LOW); Serial.println(5); delay(10); break; case 6: digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4, LOW); Serial.println(6); delay(10); break; case 7: digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4, HIGH); Serial.println(7); delay(10); break; default: digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4, LOW); Serial.println("d"); delay(10); break; } SetDirection(); } } void SetDirection() { if (Direction == 1) { Steps++; } if (Direction == 0) { Steps--; } if (Steps > 7) { Steps = 0; } if (Steps < 0) { Steps = 7; } } #define echoPin 2 #define trigPin 3 long duration; int distance; void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(5, OUTPUT); Serial.begin(9600); } void loop() { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = duration * 0.034 / 2; Serial.print("Distance: "); Serial.print(distance); Serial.println(" cm"); if (distance<=3) { digitalWrite(5, HIGH); Serial.print("Pump On"); delay(150); digitalWrite(5, LOW); Serial.print("Pump OFF"); delay(2000); } else { digitalWrite(5, LOW); Serial.print("Pump OFF"); } delay(50); } #include //1602 //1602Arduino84 //LiquidCrystal lcd(12,11,10,9,8,7,6,5,4,3,2); //8 LiquidCrystal lcd(13,12,7,6,5,4,3); //4 P13--LCD 4 P12--LCD 5 //P7--LCD 6 P6--LCD 11 P5--LCD 12 P4--LCD 13 P3--LCD 14 int Echo = A1; // Echo(P2.0) int Trig =A0; // Trig (P2.1) int Front_Distance = 0;// int Left_Distance = 0; int Right_Distance = 0; int Left_motor_go=8; //(IN1) int Left_motor_back=9; //(IN2) int Right_motor_go=10; // (IN3) int Right_motor_back=11; // (IN4) int key=A2;// A2 int beep=A3;// A3 //const int SensorRight = 3; //(P3.2 OUT1) //const int SensorLeft = 4; //(P3.3 OUT2) //const int SensorRight_2 = 6; //(P3.5 OUT4) //const int SensorLeft_2 = 5; //(P3.4 OUT3) //int SL; // //int SR; // //int SL_2; // //int SR_2; // int servopin=2;//2 int myangle;// int pulsewidth;// int val; void setup() { Serial.begin(9600); // //IO pinMode(Left_motor_go,OUTPUT); // PIN 8 (PWM) pinMode(Left_motor_back,OUTPUT); // PIN 9 (PWM) pinMode(Right_motor_go,OUTPUT);// PIN 10 (PWM) pinMode(Right_motor_back,OUTPUT);// PIN 11 (PWM) pinMode(key,INPUT);// pinMode(beep,OUTPUT); // pinMode(SensorRight, INPUT); // // pinMode(SensorLeft, INPUT); // //pinMode(SensorRight_2, INPUT); // //pinMode(SensorLeft_2, INPUT); // // pinMode(Echo, INPUT); // pinMode(Trig, OUTPUT); // lcd.begin(16,2); //1602 //1602216 pinMode(servopin,OUTPUT);// } //================================================ //void run(int time) // void run() // { digitalWrite(Right_motor_go,HIGH); // digitalWrite(Right_motor_back,LOW); analogWrite(Right_motor_go,165);//PWM0~255 analogWrite(Right_motor_back,0); digitalWrite(Left_motor_go,LOW); // digitalWrite(Left_motor_back,HIGH); analogWrite(Left_motor_go,0);//PWM0~255 analogWrite(Left_motor_back,160); //delay(time * 100); // } void brake(int time) // { digitalWrite(Right_motor_go,LOW); digitalWrite(Right_motor_back,LOW); digitalWrite(Left_motor_go,LOW); digitalWrite(Left_motor_back,LOW); delay(time * 100);// } void left(int time) //() //void left() //() { digitalWrite(Right_motor_go,HIGH); // digitalWrite(Right_motor_back,LOW); analogWrite(Right_motor_go,180); analogWrite(Right_motor_back,0);//PWM0~255 digitalWrite(Left_motor_go,LOW); // digitalWrite(Left_motor_back,LOW); analogWrite(Left_motor_go,0); analogWrite(Left_motor_back,0);//PWM0~255 delay(time * 100); // } void spin_left(int time) //() { digitalWrite(Right_motor_go,HIGH); // digitalWrite(Right_motor_back,LOW); analogWrite(Right_motor_go,200); analogWrite(Right_motor_back,0);//PWM0~255 digitalWrite(Left_motor_go,HIGH); // digitalWrite(Left_motor_back,LOW); analogWrite(Left_motor_go,200); analogWrite(Left_motor_back,0);//PWM0~255 delay(time * 100); // } void right(int time) //void right() //() { digitalWrite(Right_motor_go,LOW); // digitalWrite(Right_motor_back,LOW); analogWrite(Right_motor_go,0); analogWrite(Right_motor_back,0);//PWM0~255 digitalWrite(Left_motor_go,LOW);// digitalWrite(Left_motor_back,HIGH); analogWrite(Left_motor_go,0); analogWrite(Left_motor_back,200);//PWM0~255 delay(time * 100); // } void spin_right(int time) //() { digitalWrite(Right_motor_go,LOW); // digitalWrite(Right_motor_back,HIGH); analogWrite(Right_motor_go,0); analogWrite(Right_motor_back,150);//PWM0~255 digitalWrite(Left_motor_go,LOW);// digitalWrite(Left_motor_back,HIGH); analogWrite(Left_motor_go,0); analogWrite(Left_motor_back,150);//PWM0~255 delay(time * 100); // } void back(int time) // { digitalWrite(Right_motor_go,LOW); // digitalWrite(Right_motor_back,HIGH); analogWrite(Right_motor_go,0); analogWrite(Right_motor_back,150);//PWM0~255 digitalWrite(Left_motor_go,HIGH); // digitalWrite(Left_motor_back,LOW); analogWrite(Left_motor_go,150); analogWrite(Left_motor_back,0);//PWM0~255 delay(time * 100); // } //========================================================== void keysacn()// { int val; val=digitalRead(key);//7 val while(!digitalRead(key))// { val=digitalRead(key);// } while(digitalRead(key))// { delay(10); //10ms val=digitalRead(key);//7 val if(val==HIGH) // { digitalWrite(beep,HIGH); // while(!digitalRead(key)) // digitalWrite(beep,LOW); // } else digitalWrite(beep,LOW); // } } float Distance_test() // { digitalWrite(Trig, LOW); // 2s delayMicroseconds(2); digitalWrite(Trig, HIGH); // 10s10s delayMicroseconds(10); digitalWrite(Trig, LOW); // float Fdistance = pulseIn(Echo, HIGH); // () Fdistance= Fdistance/58; //58 Y=X*344/2 // X= 2*Y/344 ==X=0.0058*Y ===/58 //Serial.print("Distance:"); // //Serial.println(Fdistance); // //Distance = Fdistance; return Fdistance; } void Distance_display(int Distance)// { if((2 Right_Distance)// { left(3);// brake(1);// } else// { right(3);// brake(1);// } } else { run(); // } } }
Claims:To help the healthcare workers an invention was made called as “AutoSanitBot”. The robot replaces only the risky task i.e. moving from place to place in Covid environment. The robot would undertake the cleaning/sanitizing and save the health care professionals from doing this ordinary but highly risky task. As the robots take-up the ordinary or normal risky tasks, the healthcare professionals can save their time and undertake more complicated or quality works, which is much needed in Covid environment. , Description:Introduction
Current wave of Corona Virus has affected many Doctors, Nurses, and other Health. The problem is that as the healthcare professional move from place to place tending patients or doing some common chore like cleaning or sanitizing, they are also at great risk of contact. For example, the person responsible for cleaning and sanitizing moves from floor to floor and is a cause of great concern. He or she can also be the accelerator to the spreads asn the physical contacts is increased manifold.
AutoSanitBot Operation
To help the healthcare workers an invention was made called as “AutoSanitBot”. The robot replaces only the risky task i.e. moving from place to place in Covid environment. The robot would undertake the cleaning/sanitizing and save the health care professionals from doing this ordinary but highly risky task. As the robots take-up the ordinary or normal risky tasks, the healthcare professionals can save their time and undertake more complicated or quality works, which is much needed in Covid environment.
My first invention “The Universal Automaton” would construct this robot “AutoSanitBot” using a 3d printer. The details of “The Universal Automaton” have already been submitted for approval vide C.B.R. #15310 (App #: 202121030335).
Tools and Technologies
1. Used the current version of Arduino
2. Arduino programs to operate the AutoSanitBot Robot
3. The Universal Automaton used to construct the AutoSanitBot Robot
Arduino programs
#define CW 3 //CW is defined as pin #7//
#define CCW 4 //CCW is defined as pin #8//
#define CW9 9 //CW is defined as pin #7//
#define CW10 10 //CCW is defined as pin #8//
#define CW11 11 //CW is defined as pin #7//
#define CW12 12 //CCW is defined as pin #8//
#define CW5 5 //CW is defined as pin #7//
#define CW6 6 //CCW is defined as pin #8//
#define echoPin 7 // attach pin D2 Arduino to pin Echo of HC-SR04
#define trigPin 8 //attach pin D3 Arduino to pin Trig of HC-SR04
long duration; // variable for the duration of sound wave travel
int distance; // variable for the distance measurement
void setup() { //Setup runs once//
pinMode(CW, OUTPUT); //Set CW as an output//
pinMode(CCW, OUTPUT); //Set CCW as an output//
pinMode(CW9, OUTPUT); //Set CW as an output//
pinMode(CW10, OUTPUT); //Set CCW as an output//
pinMode(CW11, OUTPUT); //Set CW as an output//
pinMode(CW12, OUTPUT); //Set CCW as an output//
pinMode(CW5, OUTPUT); //Set CW as an output//
pinMode(CW6, OUTPUT); //Set CCW as an output//
pinMode(trigPin, OUTPUT); // Sets the trigPin as an OUTPUT
pinMode(echoPin, INPUT); // Sets the echoPin as an INPUT
Serial.begin(9600); // // Serial Communication is starting with 9600 of baudrate speed
Serial.println("Ultrasonic Sensor HC-SR04 Test"); // print some text in Serial Monitor
Serial.println("with Arduino UNO R3");
}
void loop() { //Loop runs forever//
digitalWrite(trigPin, LOW);
delay(250);
digitalWrite(trigPin, HIGH);
delay(250);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2; // Speed of sound wave divided by 2 (go and back)
Serial.print("Distance: ");
delay(250);
Serial.print(distance);
Serial.println(" cm");
digitalWrite(CW,LOW); //INITIALIZE Motor //
digitalWrite(CCW,LOW);
digitalWrite(CW9,LOW);
digitalWrite(CW10,LOW);
digitalWrite(CW11,LOW);
digitalWrite(CW12,LOW);
digitalWrite(CW5,LOW);
digitalWrite(CW6,LOW);
delay(250); //for 1 second//
if (distance < 10 && distance > 0) {
digitalWrite(CW,HIGH); //Motor runs clockwise//
digitalWrite(CCW,LOW); //Motor runs clockwise//
digitalWrite(CW9,HIGH); //Motor runs clockwise//
digitalWrite(CW10,LOW); //Motor runs clockwise//
digitalWrite(CW11,HIGH); //Motor runs clockwise//
digitalWrite(CW12,LOW); //Motor runs clockwise//
digitalWrite(CW5,HIGH); //Motor runs clockwise//
digitalWrite(CW6,LOW); //Motor runs clockwise//
delay(500); //for 1 second//
digitalWrite(CW,LOW); //Motor runs clockwise//
digitalWrite(CCW,LOW); //Motor runs clockwise//
digitalWrite(CW9,LOW); //Motor runs clockwise//
digitalWrite(CW10,LOW); //Motor runs clockwise//
digitalWrite(CW11,LOW); //Motor runs clockwise//
digitalWrite(CW12,LOW); //Motor runs clockwise//
digitalWrite(CW5,LOW); //Motor runs clockwise//
digitalWrite(CW6,LOW); //Motor runs clockwise//
Serial.print("waiting: ");
delay(250); //for 1 second//
digitalWrite(CW, LOW); //Motor stops//
digitalWrite(CCW, HIGH);//Motor runs counter-clockwise//
digitalWrite(CW9, LOW); //Motor stops//
digitalWrite(CW10, HIGH);//Motor runs counter-clockwise//
digitalWrite(CW11, LOW); //Motor stops//
digitalWrite(CW12, HIGH);//Motor runs counter-clockwise//
digitalWrite(CW5, LOW); //Motor stops//
digitalWrite(CW6, HIGH);//Motor runs counter-clockwise//
delay(500); //For 1 second//
digitalWrite(CW,LOW); //Motor runs clockwise//
digitalWrite(CCW,LOW); //Motor runs clockwise//
digitalWrite(CW9,LOW); //Motor runs clockwise//
digitalWrite(CW10,LOW); //Motor runs clockwise//
digitalWrite(CW11,LOW); //Motor runs clockwise//
digitalWrite(CW12,LOW); //Motor runs clockwise//
digitalWrite(CW5,LOW); //Motor runs clockwise//
digitalWrite(CW6,LOW); //Motor runs clockwise//
Serial.print("waiting: ");
delay(250);
}
}
#define IN1 11
#define IN2 10
#define IN3 9
#define IN4 8
int Steps = 0;
boolean Direction = true;//
unsigned long last_time;
unsigned long currentMillis ;
int steps_left = 4095;
long time;
void setup()
{
Serial.begin(9600);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}
void loop()
{
while (steps_left > 0)
{
currentMillis = micros();
if (currentMillis - last_time >= 1000)
{
stepper(1);
time = time + micros() - last_time;
last_time = micros();
steps_left--;
}
}
Serial.println(time);
Serial.println("Wait...!");
delay(2000);
Direction = !Direction;
steps_left = 4095;
}
void stepper(int xw)
{
for (int x = 0; x < xw; x++)
{
switch (Steps)
{
case 0:
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
Serial.println(0);
delay(10);
break;
case 1:
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, HIGH);
Serial.println(1);
delay(10);
break;
case 2:
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
Serial.println(2);
delay(10);
break;
case 3:
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
Serial.println(3);
delay(10);
break;
case 4:
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
Serial.println(4);
delay(10);
break;
case 5:
digitalWrite(IN1, HIGH);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
Serial.println(5);
delay(10);
break;
case 6:
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
Serial.println(6);
delay(10);
break;
case 7:
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
Serial.println(7);
delay(10);
break;
default:
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
Serial.println("d");
delay(10);
break;
}
SetDirection();
}
}
void SetDirection()
{
if (Direction == 1)
{
Steps++;
}
if (Direction == 0)
{
Steps--;
}
if (Steps > 7)
{
Steps = 0;
}
if (Steps < 0)
{
Steps = 7;
}
}
#define echoPin 2
#define trigPin 3
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(5, OUTPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
if (distance<=3)
{
digitalWrite(5, HIGH);
Serial.print("Pump On");
delay(150);
digitalWrite(5, LOW);
Serial.print("Pump OFF");
delay(2000);
}
else
{
digitalWrite(5, LOW);
Serial.print("Pump OFF");
}
delay(50);
}
#include //1602
//1602Arduino84
//LiquidCrystal lcd(12,11,10,9,8,7,6,5,4,3,2); //8
LiquidCrystal lcd(13,12,7,6,5,4,3); //4 P13--LCD 4 P12--LCD 5
//P7--LCD 6 P6--LCD 11 P5--LCD 12 P4--LCD 13 P3--LCD 14
int Echo = A1; // Echo(P2.0)
int Trig =A0; // Trig (P2.1)
int Front_Distance = 0;//
int Left_Distance = 0;
int Right_Distance = 0;
int Left_motor_go=8; //(IN1)
int Left_motor_back=9; //(IN2)
int Right_motor_go=10; // (IN3)
int Right_motor_back=11; // (IN4)
int key=A2;// A2
int beep=A3;// A3
//const int SensorRight = 3; //(P3.2 OUT1)
//const int SensorLeft = 4; //(P3.3 OUT2)
//const int SensorRight_2 = 6; //(P3.5 OUT4)
//const int SensorLeft_2 = 5; //(P3.4 OUT3)
//int SL; //
//int SR; //
//int SL_2; //
//int SR_2; //
int servopin=2;//2
int myangle;//
int pulsewidth;//
int val;
void setup()
{
Serial.begin(9600); //
//IO
pinMode(Left_motor_go,OUTPUT); // PIN 8 (PWM)
pinMode(Left_motor_back,OUTPUT); // PIN 9 (PWM)
pinMode(Right_motor_go,OUTPUT);// PIN 10 (PWM)
pinMode(Right_motor_back,OUTPUT);// PIN 11 (PWM)
pinMode(key,INPUT);//
pinMode(beep,OUTPUT);
// pinMode(SensorRight, INPUT); //
// pinMode(SensorLeft, INPUT); //
//pinMode(SensorRight_2, INPUT); //
//pinMode(SensorLeft_2, INPUT); //
//
pinMode(Echo, INPUT); //
pinMode(Trig, OUTPUT); //
lcd.begin(16,2); //1602
//1602216
pinMode(servopin,OUTPUT);//
}
//================================================
//void run(int time) //
void run() //
{
digitalWrite(Right_motor_go,HIGH); //
digitalWrite(Right_motor_back,LOW);
analogWrite(Right_motor_go,165);//PWM0~255
analogWrite(Right_motor_back,0);
digitalWrite(Left_motor_go,LOW); //
digitalWrite(Left_motor_back,HIGH);
analogWrite(Left_motor_go,0);//PWM0~255
analogWrite(Left_motor_back,160);
//delay(time * 100); //
}
void brake(int time) //
{
digitalWrite(Right_motor_go,LOW);
digitalWrite(Right_motor_back,LOW);
digitalWrite(Left_motor_go,LOW);
digitalWrite(Left_motor_back,LOW);
delay(time * 100);//
}
void left(int time) //()
//void left() //()
{
digitalWrite(Right_motor_go,HIGH); //
digitalWrite(Right_motor_back,LOW);
analogWrite(Right_motor_go,180);
analogWrite(Right_motor_back,0);//PWM0~255
digitalWrite(Left_motor_go,LOW); //
digitalWrite(Left_motor_back,LOW);
analogWrite(Left_motor_go,0);
analogWrite(Left_motor_back,0);//PWM0~255
delay(time * 100); //
}
void spin_left(int time) //()
{
digitalWrite(Right_motor_go,HIGH); //
digitalWrite(Right_motor_back,LOW);
analogWrite(Right_motor_go,200);
analogWrite(Right_motor_back,0);//PWM0~255
digitalWrite(Left_motor_go,HIGH); //
digitalWrite(Left_motor_back,LOW);
analogWrite(Left_motor_go,200);
analogWrite(Left_motor_back,0);//PWM0~255
delay(time * 100); //
}
void right(int time)
//void right() //()
{
digitalWrite(Right_motor_go,LOW); //
digitalWrite(Right_motor_back,LOW);
analogWrite(Right_motor_go,0);
analogWrite(Right_motor_back,0);//PWM0~255
digitalWrite(Left_motor_go,LOW);//
digitalWrite(Left_motor_back,HIGH);
analogWrite(Left_motor_go,0);
analogWrite(Left_motor_back,200);//PWM0~255
delay(time * 100); //
}
void spin_right(int time) //()
{
digitalWrite(Right_motor_go,LOW); //
digitalWrite(Right_motor_back,HIGH);
analogWrite(Right_motor_go,0);
analogWrite(Right_motor_back,150);//PWM0~255
digitalWrite(Left_motor_go,LOW);//
digitalWrite(Left_motor_back,HIGH);
analogWrite(Left_motor_go,0);
analogWrite(Left_motor_back,150);//PWM0~255
delay(time * 100); //
}
void back(int time) //
{
digitalWrite(Right_motor_go,LOW); //
digitalWrite(Right_motor_back,HIGH);
analogWrite(Right_motor_go,0);
analogWrite(Right_motor_back,150);//PWM0~255
digitalWrite(Left_motor_go,HIGH); //
digitalWrite(Left_motor_back,LOW);
analogWrite(Left_motor_go,150);
analogWrite(Left_motor_back,0);//PWM0~255
delay(time * 100); //
}
//==========================================================
void keysacn()//
{
int val;
val=digitalRead(key);//7 val
while(!digitalRead(key))//
{
val=digitalRead(key);//
}
while(digitalRead(key))//
{
delay(10); //10ms
val=digitalRead(key);//7 val
if(val==HIGH) //
{
digitalWrite(beep,HIGH); //
while(!digitalRead(key)) //
digitalWrite(beep,LOW); //
}
else
digitalWrite(beep,LOW); //
}
}
float Distance_test() //
{
digitalWrite(Trig, LOW); // 2s
delayMicroseconds(2);
digitalWrite(Trig, HIGH); // 10s10s
delayMicroseconds(10);
digitalWrite(Trig, LOW); //
float Fdistance = pulseIn(Echo, HIGH); // ()
Fdistance= Fdistance/58; //58 Y=X*344/2
// X= 2*Y/344 ==X=0.0058*Y ===/58
//Serial.print("Distance:"); //
//Serial.println(Fdistance); //
//Distance = Fdistance;
return Fdistance;
}
void Distance_display(int Distance)//
{
if((2 Right_Distance)//
{
left(3);//
brake(1);//
}
else//
{
right(3);//
brake(1);//
}
}
else
{
run(); //
}
}
}
| # | Name | Date |
|---|---|---|
| 1 | 202121030458-FORM 1 [07-07-2021(online)].pdf | 2021-07-07 |
| 2 | 202121030458-DRAWINGS [07-07-2021(online)].pdf | 2021-07-07 |
| 3 | 202121030458-COMPLETE SPECIFICATION [07-07-2021(online)].pdf | 2021-07-07 |
| 4 | 202121030458-FORM-9 [14-07-2021(online)].pdf | 2021-07-14 |
| 5 | 202121030458-FORM 13 [17-08-2021(online)].pdf | 2021-08-17 |
| 6 | Abstract1.jpg | 2021-10-19 |