Compare commits
No commits in common. "4a5314c78d29bb25bfeb9492d59c026188139f5b" and "2a409576369fe130e42f0e7d366014e2df012fa2" have entirely different histories.
4a5314c78d
...
2a40957636
|
@ -29,8 +29,4 @@ void loop () {
|
||||||
softSerial.write(cmdChar);
|
softSerial.write(cmdChar);
|
||||||
Serial.println(cmdChar);
|
Serial.println(cmdChar);
|
||||||
}
|
}
|
||||||
if (softSerial.available()) {
|
|
||||||
cmdChar = (char)softSerial.read();
|
|
||||||
Serial.println(cmdChar);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -93,7 +93,7 @@ void loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmdChar != 'z') {
|
if (cmdChar != 'z') {
|
||||||
cmd(cmdChar, 0);
|
cmd(cmdChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdChar = 'z';
|
cmdChar = 'z';
|
||||||
|
@ -103,7 +103,7 @@ void loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmdChar != 'z') {
|
if (cmdChar != 'z') {
|
||||||
cmd(cmdChar, 1);
|
cmd(cmdChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdChar = 'z';
|
cmdChar = 'z';
|
||||||
|
@ -116,11 +116,11 @@ void loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmd (char which, int source) {
|
void cmd (char which) {
|
||||||
if (which == Fcmd && !Frunning) {
|
if (which == Fcmd && !Frunning) {
|
||||||
forward(source);
|
forward();
|
||||||
} else if (which == Bcmd && !Brunning) {
|
} else if (which == Bcmd && !Brunning) {
|
||||||
backward(source);
|
backward();
|
||||||
} else if (which == cmd_debug) {
|
} else if (which == cmd_debug) {
|
||||||
debug();
|
debug();
|
||||||
} else if (which == cmd_connect) {
|
} else if (which == cmd_connect) {
|
||||||
|
@ -130,25 +130,15 @@ void cmd (char which, int source) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void forward (int source) {
|
void forward () {
|
||||||
log("forward()");
|
log("forward()");
|
||||||
if (source == 0) {
|
|
||||||
Serial.println(Fcmd);
|
|
||||||
} else if (source == 1) {
|
|
||||||
softSerial.write(Fcmd);
|
|
||||||
}
|
|
||||||
Ftime = timer;
|
Ftime = timer;
|
||||||
set_speed(Fmotor, frameSpeed);
|
set_speed(Fmotor, frameSpeed);
|
||||||
clockwise(Fmotor);
|
clockwise(Fmotor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void backward (int source) {
|
void backward () {
|
||||||
log("backward()");
|
log("backward()");
|
||||||
if (source == 0) {
|
|
||||||
Serial.println(Bcmd);
|
|
||||||
} else if (source == 1) {
|
|
||||||
softSerial.write(Bcmd);
|
|
||||||
}
|
|
||||||
Btime = timer;
|
Btime = timer;
|
||||||
set_speed(Bmotor, frameSpeed);
|
set_speed(Bmotor, frameSpeed);
|
||||||
counter_clockwise(Bmotor);
|
counter_clockwise(Bmotor);
|
||||||
|
@ -304,9 +294,9 @@ void btnCmd (int index, int time) {
|
||||||
int multiple = floor(time / buttonPress);
|
int multiple = floor(time / buttonPress);
|
||||||
if (multiple > ButtonMultiple[index]) {
|
if (multiple > ButtonMultiple[index]) {
|
||||||
if (index == Fmotor) {
|
if (index == Fmotor) {
|
||||||
cmd(Fcmd, 0);
|
cmd(Fcmd);
|
||||||
} else if (index == Bmotor) {
|
} else if (index == Bmotor) {
|
||||||
cmd(Bcmd, 0);
|
cmd(Bcmd);
|
||||||
}
|
}
|
||||||
ButtonMultiple[index] = multiple;
|
ButtonMultiple[index] = multiple;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue