Welcome GitHub repository of my school project!
This is my Library for the Ramps 1.4 shield. The annotations are currently in Dutch, but I'm prepared to translate it all if there is enough demand.
these are the fuctions a Ramps object can do:
-
Create a ramps object:
Ramps ramps = Ramps();
-
Home the X, Y and Z axes:
ramps.home();
-
Move to a position in a straight line:
ramps.moveTo(targetX, TargetY, TargetZ, delay);
delay is the time between steps in microseconds
-
Turn the the led on or off:
ramps.led(On);
On is a boolean
-
Turn the fan on or off:
ramps.fan(On);
On is a boolean
-
Control the heater:
ramps.heater(heater, value);
heater says which heater: Either 0 for heater_0 or 1 for heater_1.
value is a byte that says how hot (PWM controlled)
-
The PololuDriver objects:
ramps.motorX ramps.motorY ramps.motorZ ramps.motorE ramps.motorQ
These are created by the Ramps library and can be directly controlled with the commands of the PololuDriver.h library. An example:
ramps.motorX.stepOn(); delayMicroseconds(500); ramps.motorX.stepOff();
The pololuDriver.h library can be used for derect control of a pololu A4988 driver or a DRV8825
-
Create a PololuDriver object:
pololuStepper motor = pololuStepper(stepPin, dirPin, enablePin);
the stepPin, dirPin and enablePin are the connections to the driver.
-
Set the direction:
motor.setDir(direction);
The direction is either 1 (DIR is LOW) or -1 (DIR is HIGH)
-
Manual stepping
These two functions are used together for manual stepping.
-
stepOn is to make the motor step
motor.stepOn();
the moment you call stepOn, the motor will step and the position will be updated. if everything is handled correctly, it will return a boolean.
-
stepOff is for finishing the step.
motor.stepOff();
stepOff has to be called after stepOn and with a delay inbetween:
motor.stepOn(); delayMicroseconds(500); motor.stepOff();
If stepOff isn't called after stepOn and you call stepOn agian, the motor won't step, position won't be updated and stepOn will return false!
-
-
Move a number of steps
motor.autoStep(amount, delay);
Move the amount of steps with a delay in microseconds in between each step.
-
Move to a position
motor.moveTo(targetPos, delay);
Move to the target position with a delay in microseconds in between each step.