Advertisement
Guest User

FarmBot Basic Form (Needs 2 evolve)

a guest
Sep 16th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <AccelStepper.h>
  2.  
  3. #define homeSW 2
  4. #define pinSW 3
  5. #define actionWater 0
  6.  
  7. AccelStepper steppers[3] = {
  8.   AccelStepper(1, 4, 5),
  9.   AccelStepper(1, 6, 7),
  10.   AccelStepper(1, 8, 9)
  11. };
  12.  
  13. void setup() {
  14.   pinMode(homeSW, INPUT_PULLUP);
  15.   pinMode(pinSW, INPUT_PULLUP);
  16.   delay(5);
  17.  
  18.   stepper.setMaxSpeed(5000);
  19.   stepper.setAcceleration(5000);
  20.   Serial.begin(9600);
  21.   Serial.println("Started!");
  22.  
  23.   for(int i = 0; i < steppers.length; i++) {
  24.       doHoming(i);
  25.   }
  26. }
  27.  
  28. void loop() {
  29.  
  30. }
  31.  
  32. /**
  33.  * Accepts stepper index and moves it back to 0.
  34.  * @param st - The stepper's index.
  35.  */
  36. void doHoming(int st) {
  37.  
  38. }
  39.  
  40. /**
  41.  * Moves motor to x, y, z
  42.  * @param x the x location
  43.  * @param y the y location
  44.  * @param z the z location
  45.  */
  46. void goto(int x, int y, int z) {
  47.   Serial.println("Moved to: " + (String) x + ", " + (String) y + ", " + (String) z);
  48. }
  49.  
  50. /**
  51.  * Does an action all the grid points
  52.  */
  53. void grid(int action) {
  54.   Serial.println("Did action " + action);
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement