tweak control algo

This commit is contained in:
2020-10-02 11:36:33 -07:00
parent 90b9831079
commit c2fbf18814
2 changed files with 50 additions and 85 deletions

View File

@@ -57,7 +57,8 @@ int main() {
radio.openReadingPipe(1, dozer_pipe);
radio.startListening();
delay(1000);
pinMode(9, INPUT_PULLUP);
delay(3000);
int16_t ref_stick_1_y = analogRead(A4); // RY
int16_t ref_stick_1_x = analogRead(A5); // RX
@@ -66,6 +67,17 @@ int main() {
while (true) {
int val = digitalRead(9); // read input value
Serial.println(val);
if (val == 0) { // check if the input is HIGH (button released)
ref_stick_1_y = analogRead(A4); // RY
ref_stick_1_x = analogRead(A5); // RX
ref_stick_2_y = analogRead(A6); // LY
ref_stick_2_x = analogRead(A7); // LX
} else {
}
// Parse into a struct
StickValues stick_values;
stick_values.stick_1_y = analogRead(A5); // RY
@@ -144,6 +156,8 @@ int main() {
Serial.print(left_track);
Serial.print(", ");
Serial.print(right_track);
Serial.print(", ");
Serial.print(stick_values.stick_2_y);
Serial.println("]");
//Serial.println("");