Giter VIP home page Giter VIP logo

Comments (5)

EmbeddedMan avatar EmbeddedMan commented on June 3, 2024

Are you trying to run one of the code examples? If so, which one? If not, can you post the code you're trying to run? Also include some more information about your setup - what microcontroller board are you using, etc.

from big_easy_driver.

caroline-kornbrek avatar caroline-kornbrek commented on June 3, 2024

This is the code I was trying to use. It is the basic big easy driver demo It was posted here and on the main Big Easy Driver Page on sparkfun https://learn.sparkfun.com/tutorials/big-easy-driver-hookup-guide/all . I am using an Arduino uno, an 8 wire stepper motor and the Big Easy Driver.

/******************************************************************************
SparkFun Big Easy Driver Basic Demo
Toni Klopfenstein @ SparkFun Electronics
February 2015
https://github.com/sparkfun/Big_Easy_Driver
Simple demo sketch to demonstrate how 5 digital pins can drive a bipolar stepper motor,
using the Big Easy Driver (https://www.sparkfun.com/products/12859). Also shows the ability to change
microstep size, and direction of motor movement.
Development environment specifics:
Written in Arduino 1.6.0
This code is beerware; if you see me (or any other SparkFun employee) at the local, and you've found our code helpful, please buy us a round!
Distributed as-is; no warranty is given.
Example based off of demos by Brian Schmalz (designer of the Big Easy Driver).
http://www.schmalzhaus.com/EasyDriver/Examples/EasyDriverExamples.html
******************************************************************************/
//Declare pin functions on Arduino
#define stp 2
#define dir 3
#define MS1 4
#define MS2 5
#define MS3 6
#define EN 7

//Declare variables for functions
char user_input;
int x;
int y;
int state;

void setup() {
pinMode(stp, OUTPUT);
pinMode(dir, OUTPUT);
pinMode(MS1, OUTPUT);
pinMode(MS2, OUTPUT);
pinMode(MS3, OUTPUT);
pinMode(EN, OUTPUT);
resetBEDPins(); //Set step, direction, microstep and enable pins to default states
Serial.begin(9600); //Open Serial connection for debugging
Serial.println("Begin motor control");
Serial.println();
//Print function list for user selection
Serial.println("Enter number for control option:");
Serial.println("1. Turn at default microstep mode.");
Serial.println("2. Reverse direction at default microstep mode.");
Serial.println("3. Turn at 1/16th microstep mode.");
Serial.println("4. Step forward and reverse directions.");
Serial.println();
}

//Main loop
void loop() {
while(Serial.available()){
user_input = Serial.read(); //Read user input and trigger appropriate function
digitalWrite(EN, LOW); //Pull enable pin low to set FETs active and allow motor control
if (user_input =='1')
{
StepForwardDefault();
}
else if(user_input =='2')
{
ReverseStepDefault();
}
else if(user_input =='3')
{
SmallStepMode();
}
else if(user_input =='4')
{
ForwardBackwardStep();
}
else
{
Serial.println("Invalid option entered.");
}
resetBEDPins();
}
}

//Reset Big Easy Driver pins to default states
void resetBEDPins()
{
digitalWrite(stp, LOW);
digitalWrite(dir, LOW);
digitalWrite(MS1, LOW);
digitalWrite(MS2, LOW);
digitalWrite(MS3, LOW);
digitalWrite(EN, HIGH);
}

//Default microstep mode function
void StepForwardDefault()
{
Serial.println("Moving forward at default step mode.");
digitalWrite(dir, LOW); //Pull direction pin low to move "forward"
for(x= 1; x<1000; x++) //Loop the forward stepping enough times for motion to be visible
{
digitalWrite(stp,HIGH); //Trigger one step forward
delay(1);
digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
delay(1);
}
Serial.println("Enter new option");
Serial.println();
}

//Reverse default microstep mode function
void ReverseStepDefault()
{
Serial.println("Moving in reverse at default step mode.");
digitalWrite(dir, HIGH); //Pull direction pin high to move in "reverse"
for(x= 1; x<1000; x++) //Loop the stepping enough times for motion to be visible
{
digitalWrite(stp,HIGH); //Trigger one step
delay(1);
digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
delay(1);
}
Serial.println("Enter new option");
Serial.println();
}

// 1/16th microstep foward mode function
void SmallStepMode()
{
Serial.println("Stepping at 1/16th microstep mode.");
digitalWrite(dir, LOW); //Pull direction pin low to move "forward"
digitalWrite(MS1, HIGH); //Pull MS1,MS2, and MS3 high to set logic to 1/16th microstep resolution
digitalWrite(MS2, HIGH);
digitalWrite(MS3, HIGH);
for(x= 1; x<1000; x++) //Loop the forward stepping enough times for motion to be visible
{
digitalWrite(stp,HIGH); //Trigger one step forward
delay(1);
digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
delay(1);
}
Serial.println("Enter new option");
Serial.println();
}

//Forward/reverse stepping function
void ForwardBackwardStep()
{
Serial.println("Alternate between stepping forward and reverse.");
for(x= 1; x<5; x++) //Loop the forward stepping enough times for motion to be visible
{
//Read direction pin state and change it
state=digitalRead(dir);
if(state == HIGH)
{
digitalWrite(dir, LOW);
}
else if(state ==LOW)
{
digitalWrite(dir,HIGH);
}

for(y=1; y<1000; y++)
{
  digitalWrite(stp,HIGH); //Trigger one step
  delay(1);
  digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
  delay(1);
}

}
Serial.println("Enter new option");
Serial.println();
}

from big_easy_driver.

EmbeddedMan avatar EmbeddedMan commented on June 3, 2024

Caroline - when you post to GitHub, it comes through email as well. You can reply to either - they all show up on GH.

When I copy/pasted the code you provided into Arduino 1.8.7 and built for Arduino uno, I didn't get any errors or warnings.

Can you copy/paste the output of your compile (make sure to turn on verbose output for compilation in the preferences dialog box for Arduino first)? Maybe there's a clue there.

from big_easy_driver.

caroline-kornbrek avatar caroline-kornbrek commented on June 3, 2024

Checking that box in the preferences allowed it to verify. Thank you!

from big_easy_driver.

EmbeddedMan avatar EmbeddedMan commented on June 3, 2024

Very good. I'm going to close this issue since the original issue appears to be solved. Please let us know if you have any other problems with the Big Easy Driver board.

from big_easy_driver.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.