a
Dependencies: Locate Move Servo button mbed
Fork of 4thcomp by
main.cpp@14:0629ab54765c, 2016-09-08 (annotated)
- Committer:
- choutin
- Date:
- Thu Sep 08 10:08:17 2016 +0000
- Revision:
- 14:0629ab54765c
- Parent:
- 12:456d651ef4f0
- Child:
- 15:a2cdcb373d3d
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 | 12:456d651ef4f0 | 8 | |
sakanakuuun | 4:1604d599d40f | 9 | int main() |
sakanakuuun | 4:1604d599d40f | 10 | { |
choutin | 14:0629ab54765c | 11 | int team=1; |
sakanakuuun | 4:1604d599d40f | 12 | setup(); |
sakanakuuun | 4:1604d599d40f | 13 | initmotor(); |
sakanakuuun | 8:21f40f92215f | 14 | |
choutin | 14:0629ab54765c | 15 | int targetx[9] = { 600,600,600,1200,900,1200,900,1200,900 }; |
choutin | 14:0629ab54765c | 16 | int targety[9] = { team*300,team*600,team*900,team*1200,team*900,team*600,team*600,0,team*300 }; |
choutin | 14:0629ab54765c | 17 | int goalx=0,goaly1=1200,goaly2=900,goaly3=600,goaly4=300; |
choutin | 14:0629ab54765c | 18 | |
choutin | 14:0629ab54765c | 19 | //オブジェクト0,1,2回収 |
choutin | 14:0629ab54765c | 20 | pmove(targetx[0],0); |
choutin | 14:0629ab54765c | 21 | pmove(targetx[0],targety[0]); |
choutin | 14:0629ab54765c | 22 | //回収 |
choutin | 14:0629ab54765c | 23 | pmove(targetx[1],targety[1]); |
choutin | 14:0629ab54765c | 24 | //回収 |
choutin | 14:0629ab54765c | 25 | pmove(targetx[2],targety[2]); |
choutin | 14:0629ab54765c | 26 | //回収 |
choutin | 14:0629ab54765c | 27 | |
choutin | 14:0629ab54765c | 28 | pmove(600,1200);//次につなげるハブ |
choutin | 14:0629ab54765c | 29 | |
choutin | 14:0629ab54765c | 30 | pmove(goalx,goaly1); |
choutin | 14:0629ab54765c | 31 | //リリース |
choutin | 14:0629ab54765c | 32 | back300();//(300,1200)なう |
choutin | 14:0629ab54765c | 33 | /****************/ |
choutin | 14:0629ab54765c | 34 | |
choutin | 14:0629ab54765c | 35 | //オブジェクト3,4回収 |
choutin | 14:0629ab54765c | 36 | pmove(targetx[3],targety[3]); |
choutin | 14:0629ab54765c | 37 | //回収 |
choutin | 14:0629ab54765c | 38 | pmove(1200,900);//ハブ |
choutin | 14:0629ab54765c | 39 | pmove(targetx[4],targety[4]); |
choutin | 14:0629ab54765c | 40 | //回収? |
choutin | 14:0629ab54765c | 41 | pmove(goalx,goaly2); |
choutin | 14:0629ab54765c | 42 | //リリース |
choutin | 14:0629ab54765c | 43 | back300(); |
choutin | 14:0629ab54765c | 44 | /***************/ |
choutin | 14:0629ab54765c | 45 | |
choutin | 14:0629ab54765c | 46 | //オブジェクト5,6回収 |
choutin | 14:0629ab54765c | 47 | pmove(1200,900);//ハブ |
choutin | 14:0629ab54765c | 48 | pmove(targetx[5],targety[5]); |
choutin | 14:0629ab54765c | 49 | //回収 |
choutin | 14:0629ab54765c | 50 | pmove(targetx[6],targety[6]); |
choutin | 14:0629ab54765c | 51 | //回収? |
choutin | 14:0629ab54765c | 52 | pmove(goalx,goaly3); |
choutin | 14:0629ab54765c | 53 | //リリース |
choutin | 14:0629ab54765c | 54 | back300(); |
choutin | 14:0629ab54765c | 55 | /**********************/ |
choutin | 14:0629ab54765c | 56 | |
choutin | 14:0629ab54765c | 57 | //オブジェクト7,8回収 |
choutin | 14:0629ab54765c | 58 | pmove(300,0);//ハブ |
choutin | 14:0629ab54765c | 59 | pmove(targetx[7],targety[7]); |
choutin | 14:0629ab54765c | 60 | //回収 |
choutin | 14:0629ab54765c | 61 | pmove(1200,300);//ハブ |
choutin | 14:0629ab54765c | 62 | pmove(targetx[8],targety[8]); |
choutin | 14:0629ab54765c | 63 | //回収? |
choutin | 14:0629ab54765c | 64 | pmove(goalx,goaly4); |
choutin | 14:0629ab54765c | 65 | //リリース |
choutin | 14:0629ab54765c | 66 | back300(); |
choutin | 14:0629ab54765c | 67 | /**********************/ |
choutin | 14:0629ab54765c | 68 | |
choutin | 14:0629ab54765c | 69 | |
choutin | 14:0629ab54765c | 70 | |
choutin | 3:56b034c41dc5 | 71 | } |