Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DigitDisplay Motor PID Joystick_OrdoV5 mbed millis
Fork of MainProgram_BaseBaru by
Diff: main.cpp
- Revision:
- 18:1da121ddb7c1
- Parent:
- 17:e4229d77a5ab
- Child:
- 19:38f148ce00f0
diff -r e4229d77a5ab -r 1da121ddb7c1 main.cpp
--- a/main.cpp Fri Jan 27 14:42:17 2017 +0000
+++ b/main.cpp Fri Jan 27 16:20:44 2017 +0000
@@ -107,7 +107,8 @@
/* Variabel Stick */
char case_ger;
-bool launcher = false, servoGo = false, manual = true, caseTadi = false, caseSekarang = false;
+bool launcher = false, servoGo = false, manual = true;
+int caseSebelum;
/***********************************************/
/* Deklarasi Fungsi dan Procedure */
@@ -163,12 +164,10 @@
else if ((!joystick.R1)&&(!joystick.L1)&&(!joystick.atas)&&(!joystick.bawah)&&(joystick.kanan)&&(!joystick.kiri)) {
// Kanan
casegerak = 9;
- caseSekarang = true;
}
else if ((!joystick.R1)&&(!joystick.L1)&&(!joystick.atas)&&(!joystick.bawah)&&(!joystick.kanan)&&(joystick.kiri)) {
// Kiri
- casegerak = 10;
- caseSekarang = true;
+ casegerak = 10;
}
else if ((!joystick.R1)&&(!joystick.L1)&&(!joystick.atas)&&(!joystick.bawah)&&(!joystick.kanan)&&(!joystick.kiri)) {
casegerak = 12;
@@ -340,19 +339,20 @@
}
case (9) :{
// Kanan
- if (caseSekarang != caseTadi) XT = XT + PERPINDAHAN;
- caseTadi = caseSekarang;
+ if (case_ger == caseSebelum) XT = XT + PERPINDAHAN;
+
break;
}
case (10) :{
// Kiri
- if (caseSekarang!= caseTadi) XT = XT - PERPINDAHAN;
- caseTadi = caseSekarang;
+ if (case_ger == caseSebelum) XT = XT - PERPINDAHAN;
+
break;
}
default :{}
} //end of switch
+ caseSebelum = case_ger;
}
}
