Our code to draw fau

3 May
int pingPin=12;
long duration, cm;
float IR1;
float IR2;
void forward()
{
 analogWrite(11,100);
 analogWrite(10,95);
 digitalWrite(7,HIGH);
 digitalWrite(6,LOW);
 digitalWrite(9,HIGH);
 digitalWrite(8,LOW);
}
void rotateR()
{
 digitalWrite(7,HIGH);
 digitalWrite(6,LOW);
 digitalWrite(9,LOW);
 digitalWrite(8,HIGH);
 analogWrite(11,95);
 analogWrite(10,100);
}
void angleR(int degree)
{
 rotateR();
 delay(degree*(256/36));
 stop();
}
void rotateL()
{
 analogWrite(11,125);
 analogWrite(10,125);
 digitalWrite(6,HIGH);
 digitalWrite(7,LOW);
 digitalWrite(8,LOW);
 digitalWrite(9,HIGH);
}
void angleL(int degree)
{
 rotateL();
 delay(degree*(256/36));
 stop();
}
void stop()
{
 digitalWrite(6,HIGH);
 digitalWrite(7,HIGH);
 digitalWrite(8,HIGH);
 digitalWrite(9,HIGH);
 digitalWrite(11,LOW);
 digitalWrite(10,LOW);
}
void setup()
{
 pinMode(6,OUTPUT);
 pinMode(7,OUTPUT);
 pinMode(8,OUTPUT);
 pinMode(9,OUTPUT);
 pinMode(10,OUTPUT);
 pinMode(11,OUTPUT);
}
void ping()
{
 pinMode(pingPin, OUTPUT);
 digitalWrite(pingPin, LOW);
 delayMicroseconds(2);
 digitalWrite(pingPin, HIGH);
 delayMicroseconds(5);
 digitalWrite(pingPin, LOW);
}
void loop()
{
//forward();
//delay(3500);
//angleL(125);
//forward();
//delay(2500);
//stop();
//delay(8000);
 //forward();
 //delay(2000);
 //stop();
delay(1000);
forward();
delay(4000);
angleL(130);
forward();
delay(3500);
angleL(140);
forward();
delay(4000);
stop();
delay(5000);
//delay(1000);
//forward();
//delay(3500);
//stop();
//delay(3000);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: