hirromu takaki
/
06_MD_practice
quad
Revision 0:2762f6b27c5f, committed 2020-01-25
- Comitter:
- THtakahiro702286
- Date:
- Sat Jan 25 09:13:29 2020 +0000
- Commit message:
- mdpractice
Changed in this revision
diff -r 000000000000 -r 2762f6b27c5f .gitignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Sat Jan 25 09:13:29 2020 +0000 @@ -0,0 +1,4 @@ +.build +.mbed +projectfiles +*.py*
diff -r 000000000000 -r 2762f6b27c5f haseMD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/haseMD.lib Sat Jan 25 09:13:29 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/THtakahiro702286/code/haseMD/#24c2a636c6f0
diff -r 000000000000 -r 2762f6b27c5f lpf.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lpf.lib Sat Jan 25 09:13:29 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/THtakahiro702286/code/lpf/#dedf16377e0f
diff -r 000000000000 -r 2762f6b27c5f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jan 25 09:13:29 2020 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" +#include "haseMD.h" +#include "lpf.h" + +HaseMD md[4] = { HaseMD(PA_6),HaseMD(PA_7), HaseMD(PA_9),HaseMD(PB_10) }; +//DigitalIn DS[3] = { DigitalIn(PC_12), DigitalIn(PC_10), DigitalIn(PD_2) }; +Timer tim; +Serial pc(USBTX,USBRX,115200); +lpf mdlpf(1.0/300,0.005); +//DigitalIn fallut(PB_6); +//DigitalIn otw(PC_7); + +int main() +{ + tim.start(); + double pwm = 0.0,put; + + while (true) { + + pwm = sin(tim/3.0); + for(int i=0; i < 4; i++) + { + md[i].setSpeed(pwm); + + } + mdlpf.path_value(pwm); +// pwm += ((pwm < 0.1) - (pwm > 0.9)) * 0.1; +// put = 0.5 + pwm / 2.0; + put = pwm * 0.9 / 2 + 0.5; + pc.printf("%f \n\r",put); + } +} +
diff -r 000000000000 -r 2762f6b27c5f mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Sat Jan 25 09:13:29 2020 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#430e64fce8098fd5e54f6de32f3f029f35dc705f