Add working projector functions to mcopy_projector_jk

This commit is contained in:
mmcw-dev 2017-12-28 20:54:54 -05:00
parent 674dc9591e
commit ed1a0902aa
1 changed files with 30 additions and 19 deletions

View File

@ -41,7 +41,7 @@ void cmd (char val) {
} else if (val == cmd_connect) { } else if (val == cmd_connect) {
connect(); connect();
} else if (val == cmd_projector) { } else if (val == cmd_projector) {
projector(); proj_start();
} else if (val == cmd_proj_forward) { } else if (val == cmd_proj_forward) {
proj_direction(true); proj_direction(true);
} else if (val == cmd_proj_backward) { } else if (val == cmd_proj_backward) {
@ -60,26 +60,36 @@ void connect () {
log("connect()"); log("connect()");
} }
void projector () { void proj_start () {
/* FROM INTVAL if (proj_dir) {
* WILL USE OPTICAL ENDSTOP digitalWrite(proj_fwd_pin, HIGH);
* Time_start(); digitalWrite(proj_bwd_pin, LOW);
cam_dir = dir;
if (cam_dir) {
analogWrite(PIN_MOTOR_FORWARD, fwd_speed);
analogWrite(PIN_MOTOR_BACKWARD, 0);
} else { } else {
analogWrite(PIN_MOTOR_BACKWARD, bwd_speed); digitalWrite(proj_bwd_pin, HIGH);
analogWrite(PIN_MOTOR_FORWARD, 0); digitalWrite(proj_fwd_pin, LOW);
} }
running = true; proj_running = true;
if (fwd_speed == 255) { delay(500); // Let bump pass out of microswitch
delay(300);
} else { //delay(1300); //TEMPORARY DELAY FOR TESTING TIMING
delay(600); }
void proj_reading () {
proj_micro_raw = digitalRead(proj_micro_pin);
if (proj_micro_raw == 1) {
//do nothing
} else if (proj_micro_raw == 0) {
proj_stop();
} }
micro_primed = false;*/ //delay(1); //needed?
delay(1300); //TEMPORARY DELAY FOR TESTING TIMING }
void proj_stop () {
digitalWrite(proj_bwd_pin, LOW);
digitalWrite(proj_fwd_pin, LOW);
proj_running = false;
Serial.println(cmd_projector); Serial.println(cmd_projector);
log("projector()"); log("projector()");
} }
@ -93,6 +103,7 @@ void proj_direction (boolean state) {
Serial.println(cmd_proj_backward); Serial.println(cmd_proj_backward);
log("proj_direction -> false"); log("proj_direction -> false");
} }
//delay(50); //delay after direction change to account for slippage of the belt
} }
void log (String msg) { void log (String msg) {