float haha;
int pinLF=14;
int pinRF=15;
int pinLB=16;
int pinRB=17;
int PWM1=3;
int PWM2=5;
int shou=9;
int fa=8;
void setup(){
pinMode(pinLF,OUTPUT);
pinMode(pinRF,OUTPUT);
pinMode(pinLB,OUTPUT);
pinMode(pinRB,OUTPUT);
pinMode(shou,INPUT);
pinMode(fa,OUTPUT);
}
void loop(){
back(1);
digitalWrite(fa,LOW);
delayMicroseconds(2);
digitalWrite(fa,HIGH);
delayMicroseconds(10);
digitalWrite(fa,LOW);
float haha=pulseIn(shou,HIGH);
haha=haha/58;
if (haha<=15) straight(8);
if (haha>5 && haha<17) stopp(1);
if (haha>17) back(1);
}
void straight(int i)
{
analogWrite(PWM1,198);
digitalWrite(pinLB,HIGH);
digitalWrite(pinRB,LOW)
int pinLF=14;
int pinRF=15;
int pinLB=16;
int pinRB=17;
int PWM1=3;
int PWM2=5;
int shou=9;
int fa=8;
void setup(){
pinMode(pinLF,OUTPUT);
pinMode(pinRF,OUTPUT);
pinMode(pinLB,OUTPUT);
pinMode(pinRB,OUTPUT);
pinMode(shou,INPUT);
pinMode(fa,OUTPUT);
}
void loop(){
back(1);
digitalWrite(fa,LOW);
delayMicroseconds(2);
digitalWrite(fa,HIGH);
delayMicroseconds(10);
digitalWrite(fa,LOW);
float haha=pulseIn(shou,HIGH);
haha=haha/58;
if (haha<=15) straight(8);
if (haha>5 && haha<17) stopp(1);
if (haha>17) back(1);
}
void straight(int i)
{
analogWrite(PWM1,198);
digitalWrite(pinLB,HIGH);
digitalWrite(pinRB,LOW)