Arduino Programs

//box shape on plotter

int mot1up = 13;
int mot1down = 12;
int mot2right = 11;
int mot2left = 10;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.led right, led2 left, led3 up, led4 down:
pinMode(mot1up, OUTPUT);
pinMode(mot1down, OUTPUT);
pinMode(mot2right, OUTPUT);
pinMode(mot2left, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(mot1up, HIGH); // (HIGH to motor 1 up)
delay(500); // wait for .5 second
digitalWrite(mot1up, LOW); // turn off motor
delay(500); //wait .5 seconds
digitalWrite(mot2right, HIGH); //go right
delay(500); //keep going .5 second
digitalWrite(mot2right, LOW); //turn off motor
delay(500); //wait .5 seconds
digitalWrite(mot1down, HIGH); //go down
delay(500); //wait ,5 sec
digitalWrite(mot1down, LOW);
delay(500);
digitalWrite(mot2left, HIGH); //go left
delay(500);
digitalWrite(mot2left, LOW);
delay(500); //box finished

///Now start second box at top of original
digitalWrite(mot1up, HIGH); // (HIGH to motor 1 up)
delay(500); // wait for .5 second
digitalWrite(mot1up, LOW); // turn off motor
delay(500); //wait .5 seconds
//45 angle right
digitalWrite(mot1up, HIGH); //go up again
digitalWrite(mot2right, HIGH); //and go right at same time
delay(250);
digitalWrite(mot1up, LOW);
digitalWrite(mot2right, LOW);
delay(500);
digitalWrite(mot2right, HIGH); //go right
delay(500);
digitalWrite(mot2right, LOW);
digitalWrite(mot1down, HIGH); //go down
delay(500); //wait ,5 sec
digitalWrite(mot1down, LOW);
delay(500);
//angle back at 45 degrees
digitalWrite(mot1down, HIGH); //go down
digitalWrite(mot2left, HIGH); //and left
delay(250);
digitalWrite(mot1down, LOW);
digitalWrite(mot2left, LOW);
delay(500);
digitalWrite(mot1up, HIGH); //go up
delay(500);
digitalWrite(mot1up, LOW);
delay(500);
//finally go up right at 45
digitalWrite(mot1up, HIGH);
digitalWrite(mot2right, HIGH);
delay(250);
digitalWrite(mot1up, LOW);
digitalWrite(mot2right, LOW);
delay(500);
delay(5000);
// wait for a second
}

 

//Sequence Motor

int led = 13;
int led2 = 12;
int led3 = 11;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.led right, led2 left, led3 up, led4 down:
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20); // wait for a .1 second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(0);
digitalWrite(led2, HIGH);
delay(20);
digitalWrite(led2, LOW);
delay(0);
digitalWrite(led3, HIGH);
delay(20);
digitalWrite(led3, LOW);
delay(0);
// wait for a second
}

//square repeated .10 times

void setup() {
int i;
int led = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
int t =200;
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);

//loop for forward ten steps
for (i = 0; i < 10; i++) {

{
digitalWrite(led, HIGH);
delay(t);
digitalWrite(led, LOW);
delay(t);
digitalWrite(led2, HIGH);
delay(t);
digitalWrite(led2, LOW);
delay(t);
digitalWrite(led3, HIGH);
delay(t);
digitalWrite(led3, LOW);
delay(t);
digitalWrite(led4, HIGH);
delay(t);
digitalWrite(led4, LOW);
delay(t);
}
}

//loop for backward 10 steps
for (i = 0; i < 10; i++) {

}
}

void loop() {
}