Skip to content
Snippets Groups Projects
Commit 3f8ddbdb authored by Ahmed Allibhoy's avatar Ahmed Allibhoy
Browse files

Added coiling code

parent b677ec01
No related merge requests found
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
const int rpm = 200;
// for your motor
const int PIN1 = D1;
const int PIN2 = D2;
const int PIN3 = D3;
const int PIN4 = D4;
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, PIN1, PIN2, PIN3, PIN4);
int stepCount = 0; // number of steps the motor has taken
void do_steps(int num_steps){
int stepsPerSecond = stepsPerRevolution / (60 * rpm);
//int run_
}
void setup() {
wdt_disable();
pinMode(PIN1, OUTPUT);
pinMode(PIN2, OUTPUT);
pinMode(PIN3, OUTPUT);
pinMode(PIN4, OUTPUT);
Serial.println("asdfsdF");
myStepper.setSpeed(rpm);
}
void loop() {
// step 1/100 of a revolution:
int numRevolutions = 10;
myStepper.step(numRevolutions * stepsPerRevolution);
Serial.println(stepCount);
delay(500);
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment