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.
Dependents: 2022_NHK_B_UK 2022_NHK_B_sub2
SEKIkikou.h@6:34f3cf5b05f8, 2022-10-11 (annotated)
- Committer:
- ikarashikota
- Date:
- Tue Oct 11 06:45:16 2022 +0000
- Revision:
- 6:34f3cf5b05f8
- Parent:
- 5:ce2415848cb3
- Child:
- 10:10c255272359
fixed injecter function's bug
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ikarashikota | 0:04c98c2cfe16 | 1 | |
| ikarashikota | 0:04c98c2cfe16 | 2 | #ifndef SEKIKIKOU |
| ikarashikota | 0:04c98c2cfe16 | 3 | |
| ikarashikota | 0:04c98c2cfe16 | 4 | #define SEKIKIKOU |
| ikarashikota | 0:04c98c2cfe16 | 5 | |
| ikarashikota | 0:04c98c2cfe16 | 6 | #include "mbed.h" |
| ikarashikota | 0:04c98c2cfe16 | 7 | #include "ikarashiMDC.h" |
| ikarashikota | 0:04c98c2cfe16 | 8 | |
| ikarashikota | 0:04c98c2cfe16 | 9 | /*サンプルコード |
| ikarashikota | 0:04c98c2cfe16 | 10 | |
| ikarashikota | 0:04c98c2cfe16 | 11 | |
| ikarashikota | 0:04c98c2cfe16 | 12 | #include "mbed.h" |
| ikarashikota | 0:04c98c2cfe16 | 13 | #include "SEKIkikou.h" |
| ikarashikota | 0:04c98c2cfe16 | 14 | |
| ikarashikota | 0:04c98c2cfe16 | 15 | Serial serial(PC_10, PC_11, 115200); |
| ikarashikota | 0:04c98c2cfe16 | 16 | |
| ikarashikota | 0:04c98c2cfe16 | 17 | ikarashiMDC motor[] = { |
| ikarashikota | 0:04c98c2cfe16 | 18 | ikarashiMDC(0,0,SM,&serial), |
| ikarashikota | 0:04c98c2cfe16 | 19 | ikarashiMDC(0,1,SM,&serial), |
| ikarashikota | 0:04c98c2cfe16 | 20 | ikarashiMDC(0,2,SM,&serial), |
| ikarashikota | 0:04c98c2cfe16 | 21 | }; |
| ikarashikota | 0:04c98c2cfe16 | 22 | |
| ikarashikota | 0:04c98c2cfe16 | 23 | int main(){ |
| ikarashikota | 0:04c98c2cfe16 | 24 | uint8_t b[4]; |
| ikarashikota | 0:04c98c2cfe16 | 25 | int env[3]; |
| ikarashikota | 0:04c98c2cfe16 | 26 | SEKIkikou seki(&motor[0], &motor[1], &motor[2], &b[0], &b[1], &b[2], &b[3], &env[0], &env[1], &env[2]); |
| ikarashikota | 0:04c98c2cfe16 | 27 | |
| ikarashikota | 0:04c98c2cfe16 | 28 | for(int i=0; i<4; i++){ |
| ikarashikota | 0:04c98c2cfe16 | 29 | b[i] = 0; |
| ikarashikota | 0:04c98c2cfe16 | 30 | if(i < 3) env[i] = 0; |
| ikarashikota | 0:04c98c2cfe16 | 31 | } |
| ikarashikota | 0:04c98c2cfe16 | 32 | |
| ikarashikota | 0:04c98c2cfe16 | 33 | while(1){ |
| ikarashikota | 0:04c98c2cfe16 | 34 | seki.runLift(0.1); |
| ikarashikota | 0:04c98c2cfe16 | 35 | } |
| ikarashikota | 0:04c98c2cfe16 | 36 | } |
| ikarashikota | 0:04c98c2cfe16 | 37 | |
| ikarashikota | 0:04c98c2cfe16 | 38 | */ |
| ikarashikota | 0:04c98c2cfe16 | 39 | |
| ikarashikota | 0:04c98c2cfe16 | 40 | class SEKIkikou |
| ikarashikota | 0:04c98c2cfe16 | 41 | { |
| ikarashikota | 0:04c98c2cfe16 | 42 | public: |
| ikarashikota | 0:04c98c2cfe16 | 43 | |
| ikarashikota | 0:04c98c2cfe16 | 44 | SEKIkikou(ikarashiMDC *ik1, ikarashiMDC *ik2, ikarashiMDC *ik3, uint8_t *b1, uint8_t *b2, uint8_t *b3, uint8_t *b4, int *env1, int *env2, int *env3); |
| ikarashikota | 0:04c98c2cfe16 | 45 | |
| ikarashikota | 1:fab774f63278 | 46 | void init(ikarashiMDC *ik1, ikarashiMDC *ik2, ikarashiMDC *ik3, uint8_t *b1, uint8_t *b2, uint8_t *b3, uint8_t *b4, int *env1, int *env2, int *env3); |
| ikarashikota | 1:fab774f63278 | 47 | |
| ikarashikota | 0:04c98c2cfe16 | 48 | void runAll(float speedI, float speedLoad, float speedLift); |
| ikarashikota | 0:04c98c2cfe16 | 49 | |
| ikarashikota | 0:04c98c2cfe16 | 50 | void runInjection(float speed); |
| ikarashikota | 0:04c98c2cfe16 | 51 | |
| ikarashikota | 0:04c98c2cfe16 | 52 | void runLoad(float speed); |
| ikarashikota | 0:04c98c2cfe16 | 53 | |
| ikarashikota | 0:04c98c2cfe16 | 54 | void runLift(float speed); |
| ikarashikota | 1:fab774f63278 | 55 | |
| ikarashikota | 1:fab774f63278 | 56 | void stopAll(); |
| ikarashikota | 0:04c98c2cfe16 | 57 | |
| ikarashikota | 0:04c98c2cfe16 | 58 | private: |
| ikarashikota | 0:04c98c2cfe16 | 59 | Timer timer; |
| ikarashikota | 0:04c98c2cfe16 | 60 | uint8_t *button[4]; |
| ikarashikota | 0:04c98c2cfe16 | 61 | int *encoder[3]; |
| ikarashikota | 6:34f3cf5b05f8 | 62 | int encoderAngle[3]; |
| umekou | 5:ce2415848cb3 | 63 | float mspeed[3]; |
| ikarashikota | 3:e62282fc7cf6 | 64 | bool injecterFlag; |
| ikarashikota | 0:04c98c2cfe16 | 65 | ikarashiMDC *ik[3]; |
| ikarashikota | 0:04c98c2cfe16 | 66 | }; |
| ikarashikota | 0:04c98c2cfe16 | 67 | |
| ikarashikota | 0:04c98c2cfe16 | 68 | #endif |