![](/media/cache/profiles/IMG_1090_WnJdiet.JPG.50x50_q85.jpg)
d
sshape.h
- Committer:
- me33004m
- Date:
- 21 months ago
- Revision:
- 0:ee4e3ab4db45
File content as of revision 0:ee4e3ab4db45:
#ifndef SSHAPE_H #define SSHAPE_H #include "stdio.h" #include "math.h" #include "time.h" #include "mbed.h" /* samplecode #include "stdio.h" #include "sshape.h" #include "mbed.h" #include "time.h" #include "stdlib.h" #define time 10 shape sshape(time); Serial pc(USBTX, USBRX, 115200); double pm(double num); int main(void){ double stickpoints = 10.0; double add = 0; while(1){ sshape.start(); double start = sshape.start(); while(1){ pc.printf("spend time : %4.2f ",sshape.shapeTime(start)); pc.printf("shape : %.2f Target : %.2f add : %.2f\r\n",sshape.compute(stickpoints,start,add),stickpoints,add); if(pm(stickpoints-add)*sshape.compute(stickpoints,start,add) >= pm(stickpoints-add)*stickpoints){ add = sshape.compute(stickpoints,start,add); pc.printf("aaaaaaaaaaaaaaddddddddddddd %f",add); break;} } for(int i=0; i<10; i++){ pc.printf("%f",add); } stickpoints = rand() % 257- 128;; } } double pm(double num){ return (num>0)-(num<0); } */ class shape { public: shape(double time); double compute(double stickpoints,double starttime,double add); double start(); double shapeTime(double starttime); double kasokudo(double time_s,double start_s,double points_s,double add_s); int pm(double num); private: double shapeS_m; double add_m; double time_tmp; double tmp; double time_c; double shapeSpeed; double time; clock_t start_m; }; #endif