動いた

Dependencies:   lib kohiMD lpf

Files at this revision

API Documentation at this revision

Comitter:
THtakahiro702286
Date:
Sat Jun 11 07:21:47 2022 +0000
Parent:
3:f09bb38d0909
Commit message:
6/11

Changed in this revision

kohiMD.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
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- a/kohiMD.lib	Thu Mar 04 10:51:22 2021 +0000
+++ b/kohiMD.lib	Sat Jun 11 07:21:47 2022 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/Quadrifoglio/code/kohiMD/#89c4237ef94a
+https://os.mbed.com/teams/Quadrifoglio/code/kohiMD/#4c656817ca59
--- a/main.cpp	Thu Mar 04 10:51:22 2021 +0000
+++ b/main.cpp	Sat Jun 11 07:21:47 2022 +0000
@@ -1,67 +1,42 @@
 #include "mbed.h"
-//#include <math.h>
 #include "kohiMD.h"
 #include "lpf.h"
 #include "lib.h"
-
-//using namespace std::chrono;
-
 Lib lib;
 //KohiMD md[4] = {KohiMD(PA_15), KohiMD(PA_6), KohiMD(PA_7), KohiMD(PB_6)};
-//DigitalOut output[4] = {DigitalOut(PB_6),DigitalOut(PC_7),DigitalOut(PB_5),DigitalOut(PA_10)};
-//DigitalIn DS[3] = { DigitalIn(PC_12), DigitalIn(PC_10), DigitalIn(PD_2) };
 Timer t;
-//Serial pc(USBTX,USBRX,115200);
 lpf mdlpf(1.0/300,0.005);
-//DigitalIn fallut(PB_6);
-//DigitalIn otw(PC_7);
-DigitalIn b(USER_BUTTON);
-DigitalOut led(LED1);
-
+//DigitalIn b(USER_BUTTON);
+PwmOut led(LED1);
+ 
 int main()
 {
     t.start();
     int p1,p2,b1=0,b2=0,co=0;
-    double pwm = 0.0,put;
+    float pwm = 0.0,put;
     for(int i=0; i < 4; i++)
-    {
-//        output[i] = 1;
-    }
     while (true) {
-        
-//        pwm = sin(duration_cast<milliseconds>(t.elapsed_time()).count() / 1000.0);
-
-        b1 = b2-b;
-        b2 = b;
-        if(b1 == 1)
-        {
-            co++;
-        }
-        pwm = (co % 10) / 10.0 - 0.5;
-
-
-
-
+//        b1 = b2-b;
+//        b2 = b;
+//        if(b1 == 1)
+//        {
+//            co++;
+//        }
+//        pwm = (co % 10) / 10.0 - 0.5;
+        pwm = (float)sin(t.read());
         for(int i=0; i < 4; i++)
         {
             if(pwm > 0.5) pwm = 0.5;
             if(pwm < -0.5) pwm = -0.5;
-//            if(b) pwm = 0; 
-//            md[i].setSpeed(pwm);
                     }
-        led = b;
-//        mdlpf.path_value(pwm);
-//        pwm += ((pwm < 0.1) - (pwm > 0.9)) * 0.1;
+        led = put;
         put = 0.5 + pwm / 2.0;
         if(put > 0.9) put = 0.9;
         if(put < 0.1) put = 0.1;
-//        put = pwm * 0.9 / 2 + 0.5;
-        //pc.printf("%f \n\r",put);
-        lib.go(0.0);
+        lib.go(pwm);
         p1 = pwm * 100;
         p2 = put * 100;
-        printf("%d %d %d %d %d\r\n",p1,p2,(int)b,b1,b2);
+        printf("%d %d \r\n",p1,p2);
 //        printf("The time taken was %llu milliseconds\n", duration_cast<milliseconds>(t.elapsed_time()).count());
     }
-}
-
+}
\ No newline at end of file
--- a/mbed-os.lib	Thu Mar 04 10:51:22 2021 +0000
+++ b/mbed-os.lib	Sat Jun 11 07:21:47 2022 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#bfde5aa1e74802771eaeacfa74789f71677325cb
+https://github.com/ARMmbed/mbed-os/#b1796dedeb8accde1cbaecf136fab96895e23d81