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: EC def_number mbed
Fork of denku_mock_1 by
Diff: main.cpp
- Revision:
- 2:2aa947fc7c87
- Parent:
- 1:548ad0825df5
- Child:
- 3:3d240dc22c69
--- a/main.cpp Mon Nov 13 05:35:16 2017 +0000
+++ b/main.cpp Mon Nov 13 08:29:17 2017 +0000
@@ -76,7 +76,7 @@
}
void setup(){
- pc.printf("Mode 0 : otameshi\r\n");
+ pc.printf("\r\nMode 0 : otameshi\r\n");
pc.printf("Mode 1 : time-rpm jikkenn\r\n");
pc.printf("Mode 2 : Angle PID jikkenn\r\n");
pc.printf("Mode 3 : rad/s PID jikkenn\r\n");
@@ -104,7 +104,7 @@
}
void print_scan(){
- if(print)pc.printf("count=%f rotation=%f omega=%f F=%f B=%f\r\n",em.getPreCount(),em.getPreCount()/SOLUTION,em.getOmega(),(double)em.pwm_F_,(double)em.pwm_B_);
+ if(print)pc.printf("time=%f count=%f rotation=%f rpm=%f F=%f B=%f\r\n",timer.read(),em.getPreCount(),em.getPreCount()/SOLUTION,em.getOmega()*60/(2*pi),(double)em.pwm_F_,(double)em.pwm_B_);
//pc.printf("F=%f B=%f\r\n",(double)em.pwm_F_,(double)em.pwm_B_);
if(pc.readable()) {
@@ -128,6 +128,10 @@
em.setPDparam(Kp_v,0);
pc.printf("Kp_v=%f \r\n",Kp_v);
break;
+ case 's':
+ pc.printf("stop motor\r\n");
+ duty=0;
+ break;
case 'p':
pc.printf("change print state\r\n");
print=!print;
