We have been working on code that will have the tank drive and use the ultrasonic sensor to see things in front of it so it makes a turn until there ins't anything in front.
This is a piece of our code:
void stopm(void);
void forward(void);
void inputs(void);
void sharpright(void);
int duration;
float distance;
void setup(void)
{
Serial.begin (9600);
pinMode(trigger, OUTPUT);
pinMode(echo, INPUT);
pinMode(IN1 ,OUTPUT);
pinMode(IN2,OUTPUT);
pinMode(IN3,OUTPUT);
pinMode(IN4,OUTPUT);
pinMode(ENA,OUTPUT);
pinMode(ENB,OUTPUT);
digitalWrite(ENA,HIGH);
digitalWrite(ENB,HIGH);
}
No comments:
Post a Comment