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: mbed QEI-1 nRF24L01P xiugai
Revision 4:652d2be11b35, committed 2019-10-25
- Comitter:
- brainliang
- Date:
- Fri Oct 25 02:58:18 2019 +0000
- Parent:
- 3:ee5e434e047e
- Child:
- 5:fdacb4ef6709
- Commit message:
- nRF24L01,encoder,pid,pca9685
Changed in this revision
| PCA9685PWM.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PCA9685PWM.lib Fri Oct 25 02:58:18 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/lant19/code/xiugai/#970c2fa6ef3f
--- a/main.cpp Wed Oct 16 13:59:33 2019 +0000
+++ b/main.cpp Fri Oct 25 02:58:18 2019 +0000
@@ -18,11 +18,9 @@
QEI qei_PA_0(PA_0,PA_1,NC,13,QEI::X4_ENCODING);
Serial Serial_2(PA_2,PA_3);
-Ticker tick622103;
PwmOut myServoPB_0(PB_0);
PwmOut myServoPB_1(PB_1);
-
-
+Ticker tick561436;
void PID_Caculation() {
Error = 0 - Position;
@@ -60,7 +58,7 @@
}
}
-void tick622103_handle() {
+void tick561436_handle() {
Position = Position + qei_PA_0.getPulses();
qei_PA_0.reset();
Serial_2.printf("%d\n",Position);
@@ -72,10 +70,12 @@
int main() {
Serial_2.baud(9600);
-tick622103.attach(&tick622103_handle,0.05);
-
+tick561436.attach(&tick561436_handle,0.05);
Position = 0;
qei_PA_0.reset();
+P = 1;
+I = 0;
+D = 10;
while (true) {
}