a
Dependencies: Locate Move Servo button mbed
Fork of 3rdcompfixstart by
main.cpp@15:a2cdcb373d3d, 2016-09-09 (annotated)
- Committer:
- choutin
- Date:
- Fri Sep 09 05:41:41 2016 +0000
- Revision:
- 15:a2cdcb373d3d
- Parent:
- 14:0629ab54765c
- Child:
- 16:a9885a66048f
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sakanakuuun | 0:f12d257b587e | 1 | #include "mbed.h" |
choutin | 3:56b034c41dc5 | 2 | #include "math.h" |
sakanakuuun | 4:1604d599d40f | 3 | #include "locate.h" |
sakanakuuun | 4:1604d599d40f | 4 | #include "move.h" |
choutin | 12:456d651ef4f0 | 5 | #include "servo.h" |
choutin | 12:456d651ef4f0 | 6 | #include "button.h" |
choutin | 3:56b034c41dc5 | 7 | |
choutin | 15:a2cdcb373d3d | 8 | const int dist=30; |
choutin | 15:a2cdcb373d3d | 9 | const int slidedist=150; |
choutin | 15:a2cdcb373d3d | 10 | const int space=100; |
choutin | 12:456d651ef4f0 | 11 | |
sakanakuuun | 4:1604d599d40f | 12 | int main() |
sakanakuuun | 4:1604d599d40f | 13 | { |
choutin | 14:0629ab54765c | 14 | int team=1; |
sakanakuuun | 4:1604d599d40f | 15 | setup(); |
sakanakuuun | 4:1604d599d40f | 16 | initmotor(); |
sakanakuuun | 8:21f40f92215f | 17 | |
choutin | 14:0629ab54765c | 18 | int targetx[9] = { 600,600,600,1200,900,1200,900,1200,900 }; |
choutin | 15:a2cdcb373d3d | 19 | int targety[9] = { team*(300+slidedist),team*(600+slidedist),team*(900+slidedist),team*(1200+slidedist),team*(900+slidedist),team*(600+slidedist),team*(600+slidedist),team*(0+slidedist),team*(300+slidedist) }; |
choutin | 15:a2cdcb373d3d | 20 | int goalx=0,goaly1=1200+150,goaly2=900+slidedist,goaly3=600+slidedist,goaly4=300+slidedist; |
choutin | 14:0629ab54765c | 21 | |
choutin | 14:0629ab54765c | 22 | //オブジェクト0,1,2回収 |
choutin | 14:0629ab54765c | 23 | pmove(targetx[0],0); |
choutin | 14:0629ab54765c | 24 | pmove(targetx[0],targety[0]); |
choutin | 14:0629ab54765c | 25 | //回収 |
choutin | 14:0629ab54765c | 26 | pmove(targetx[1],targety[1]); |
choutin | 14:0629ab54765c | 27 | //回収 |
choutin | 14:0629ab54765c | 28 | pmove(targetx[2],targety[2]); |
choutin | 14:0629ab54765c | 29 | //回収 |
choutin | 14:0629ab54765c | 30 | |
choutin | 15:a2cdcb373d3d | 31 | pmove(600,1200+slidedist);//次につなげるハブ |
choutin | 14:0629ab54765c | 32 | |
choutin | 14:0629ab54765c | 33 | pmove(goalx,goaly1); |
choutin | 14:0629ab54765c | 34 | //リリース |
choutin | 14:0629ab54765c | 35 | back300();//(300,1200)なう |
choutin | 14:0629ab54765c | 36 | /****************/ |
choutin | 14:0629ab54765c | 37 | |
choutin | 14:0629ab54765c | 38 | //オブジェクト3,4回収 |
choutin | 15:a2cdcb373d3d | 39 | pmove(targetx[3]+space,targety[3]); |
choutin | 14:0629ab54765c | 40 | //回収 |
choutin | 15:a2cdcb373d3d | 41 | pmove(1200+space,900+slidedist);//ハブ |
choutin | 14:0629ab54765c | 42 | pmove(targetx[4],targety[4]); |
choutin | 14:0629ab54765c | 43 | //回収? |
choutin | 14:0629ab54765c | 44 | pmove(goalx,goaly2); |
choutin | 14:0629ab54765c | 45 | //リリース |
choutin | 14:0629ab54765c | 46 | back300(); |
choutin | 14:0629ab54765c | 47 | /***************/ |
choutin | 14:0629ab54765c | 48 | |
choutin | 15:a2cdcb373d3d | 49 | //オブジェクト5,7回収 |
choutin | 15:a2cdcb373d3d | 50 | pmove(1200,900+slidedist);//ハブ |
choutin | 14:0629ab54765c | 51 | pmove(targetx[5],targety[5]); |
choutin | 14:0629ab54765c | 52 | //回収 |
choutin | 15:a2cdcb373d3d | 53 | pmove(targetx[7],targety[7]); |
choutin | 14:0629ab54765c | 54 | //回収? |
choutin | 15:a2cdcb373d3d | 55 | pmove(600,0+slidedist); |
choutin | 14:0629ab54765c | 56 | //リリース |
choutin | 15:a2cdcb373d3d | 57 | pmove(600,1200+slidedist);//ハブ |
choutin | 15:a2cdcb373d3d | 58 | |
choutin | 15:a2cdcb373d3d | 59 | pmove(goalx,goaly1); |
choutin | 14:0629ab54765c | 60 | back300(); |
choutin | 14:0629ab54765c | 61 | /**********************/ |
choutin | 14:0629ab54765c | 62 | |
choutin | 15:a2cdcb373d3d | 63 | //オブジェクト6,8回収 |
choutin | 15:a2cdcb373d3d | 64 | pmove(300,0+slidedist);//ハブ |
choutin | 15:a2cdcb373d3d | 65 | pmove(900,0+slidedist);//ハブ |
choutin | 15:a2cdcb373d3d | 66 | pmove(targetx[8],targety[8]); |
choutin | 14:0629ab54765c | 67 | //回収 |
choutin | 15:a2cdcb373d3d | 68 | pmove(targetx[6],targety[6]); |
choutin | 15:a2cdcb373d3d | 69 | //回収 |
choutin | 15:a2cdcb373d3d | 70 | pmove(900,1200+slidedist); |
choutin | 14:0629ab54765c | 71 | //回収? |
choutin | 15:a2cdcb373d3d | 72 | pmove(goalx,goaly1); |
choutin | 14:0629ab54765c | 73 | //リリース |
choutin | 14:0629ab54765c | 74 | back300(); |
choutin | 14:0629ab54765c | 75 | /**********************/ |
choutin | 14:0629ab54765c | 76 | |
choutin | 14:0629ab54765c | 77 | |
choutin | 14:0629ab54765c | 78 | |
choutin | 3:56b034c41dc5 | 79 | } |