ClawMachineCosplay/build/sketch/ClawMachineOverhaul.ino.cpp

67 lines
1.7 KiB
C++

#include <Arduino.h>
#line 1 "C:\\FastAccessFiles\\CloudSync\\CodeProjects\\2024\\ClawMachineOverhaul\\ClawMachineOverhaul.ino"
#include "StepperController.h"
#include "StepperXController.h"
#include "Time.h"
#define LeftPin 3
#define RightPin 2
Time time;
#line 10 "C:\\FastAccessFiles\\CloudSync\\CodeProjects\\2024\\ClawMachineOverhaul\\ClawMachineOverhaul.ino"
void setup();
#line 26 "C:\\FastAccessFiles\\CloudSync\\CodeProjects\\2024\\ClawMachineOverhaul\\ClawMachineOverhaul.ino"
void loop();
#line 53 "C:\\FastAccessFiles\\CloudSync\\CodeProjects\\2024\\ClawMachineOverhaul\\ClawMachineOverhaul.ino"
void beginGrabSequence();
#line 10 "C:\\FastAccessFiles\\CloudSync\\CodeProjects\\2024\\ClawMachineOverhaul\\ClawMachineOverhaul.ino"
void setup(){
// Start serial communication at 115200 baud
Serial.begin(115200);
// Set the pin mode for the defined pins
pinMode(LeftPin, INPUT_PULLUP);
pinMode(RightPin, INPUT_PULLUP);
initSteppers();
initXStepper();
moveStepper(StepperAxis::Y, 10000, 1000);
}
float position = 0;
void loop(){
// Updates deltatime
time.update();
stepperXLoop();
bool left = digitalRead(LeftPin) == LOW;
bool right = digitalRead(RightPin) == LOW;
processJoystickInput(left, right);
// //Serial.print(millis());
// Serial.print("Left state: ");
// Serial.print(left);
// Serial.print(" | ");
// Serial.print("Right state: ");
// Serial.println(right);
if (Serial.available() > 0){
Serial.flush();
}
delay(10); // delay in milliseconds
}
void beginGrabSequence(){
moveStepper(StepperAxis::Y, 10000, -1000);
moveStepper(StepperAxis::Y, 10000, -1000);
}