Jimmy Huang
Created October 19, 2015

Art Machine and Arduino Shield

.

BeginnerFull instructions provided629
Art Machine and Arduino Shield

Things used in this project

Story

Read more

Schematics

IMG_3008.JPG

Code

Untitled file

C/C++
// very simple stepper motor test program
// for L298 type 
// each input controls one output
//
// Change log
// Michael Shiloh 10/5/15 - created
// Michael Shiloh 10/12/15 - corrected for crossed wires
//
// Licensing:
// This program is in the public domain 
//
// for the stepper motors with wires
// coming directly out of the motor,
// connect the wires like this:
// grey: OUT1
// green: OUT2
// yellow: OUT3
// red: OUT4

// for the stepper motors with small
// plastic connectors on the side,
// connect the wires like this:
// red: OUT1
// grey: OUT2
// yellow: OUT3
// green: OUT4

// these four Arduino outputs connect to the 
// L298 inputs which correspond to the L298
// outputs attached to the motor wires as 
// above 
const int OUT1 = 4;
const int OUT2 = 5;
const int OUT3 = 6;
const int OUT4 = 7;

void setup()  {
  pinMode(OUT1, OUTPUT);
  pinMode(OUT2, OUTPUT);
  pinMode(OUT3, OUTPUT);
  pinMode(OUT4, OUTPUT);
}

void loop() {
    digitalWrite(OUT1, LOW);
    digitalWrite(OUT2, HIGH);
    digitalWrite(OUT3, LOW);
    digitalWrite(OUT4, HIGH);
    delay(50);
    
    digitalWrite(OUT1, LOW);
    digitalWrite(OUT2, HIGH);
    digitalWrite(OUT3, HIGH);
    digitalWrite(OUT4, LOW);
    delay(50);
    
    digitalWrite(OUT1, HIGH);
    digitalWrite(OUT2, LOW);
    digitalWrite(OUT3, HIGH);
    digitalWrite(OUT4, LOW);
    delay(50);
    
    digitalWrite(OUT1, HIGH);
    digitalWrite(OUT2, LOW);
    digitalWrite(OUT3, LOW);
    digitalWrite(OUT4, HIGH);
    delay(50);
}

Credits

Jimmy Huang

Jimmy Huang

16 projects • 9 followers

Comments