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.
Dependencies: mbed
Fork of circle_war_ver_A_NUCLEO_ by
main.cpp@8:554e3d643b2d, 2016-04-03 (annotated)
- Committer:
- baba2357
- Date:
- Sun Apr 03 18:30:55 2016 +0000
- Revision:
- 8:554e3d643b2d
- Parent:
- 7:4f5cd0051db0
- Child:
- 10:369a9389bb7e
?????spi??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
baba2357 | 1:86d25c1c4bd5 | 1 | #include "mbed.h" |
baba2357 | 1:86d25c1c4bd5 | 2 | #include "pin_file.h" |
baba2357 | 1:86d25c1c4bd5 | 3 | #include "spi_nucleo.h" |
baba2357 | 1:86d25c1c4bd5 | 4 | #include "transfer.h" |
baba2357 | 2:bed6b204e64c | 5 | #include <string.h> |
baba2357 | 2:bed6b204e64c | 6 | |
baba2357 | 1:86d25c1c4bd5 | 7 | |
baba2357 | 1:86d25c1c4bd5 | 8 | int main(){ |
baba2357 | 3:6ab4e8e3aa02 | 9 | spiInit(); |
baba2357 | 8:554e3d643b2d | 10 | push.mode(PullUp); |
baba2357 | 3:6ab4e8e3aa02 | 11 | while(pushed_number==0){ //手動 |
baba2357 | 8:554e3d643b2d | 12 | transfer(); |
baba2357 | 3:6ab4e8e3aa02 | 13 | spi_mbed(); //コントローラーからの信号を読み取る |
baba2357 | 8:554e3d643b2d | 14 | Cilinder=cilinder; |
baba2357 | 3:6ab4e8e3aa02 | 15 | if(RR==1){ |
baba2357 | 3:6ab4e8e3aa02 | 16 | //右旋回の関数 |
baba2357 | 3:6ab4e8e3aa02 | 17 | } |
baba2357 | 3:6ab4e8e3aa02 | 18 | else if(LR==1){ |
baba2357 | 3:6ab4e8e3aa02 | 19 | //左旋回の関数 |
baba2357 | 3:6ab4e8e3aa02 | 20 | } |
baba2357 | 8:554e3d643b2d | 21 | else if(onoff==1){ |
baba2357 | 8:554e3d643b2d | 22 | if(updown==1) up=0.1;//上下機構上昇 |
baba2357 | 8:554e3d643b2d | 23 | else down=0.1;//上下機構下降 |
baba2357 | 8:554e3d643b2d | 24 | } |
baba2357 | 3:6ab4e8e3aa02 | 25 | else{ |
baba2357 | 3:6ab4e8e3aa02 | 26 | //読み取った値speed_X,speed_Yを速度制御にぶち込む |
baba2357 | 3:6ab4e8e3aa02 | 27 | } |
baba2357 | 1:86d25c1c4bd5 | 28 | } |
baba2357 | 3:6ab4e8e3aa02 | 29 | while(pushed_number==1){ //自動 |
baba2357 | 8:554e3d643b2d | 30 | transfer(); |
baba2357 | 3:6ab4e8e3aa02 | 31 | getGyro(); |
baba2357 | 3:6ab4e8e3aa02 | 32 | //自己位置 |
baba2357 | 3:6ab4e8e3aa02 | 33 | //エアシリンダー |
baba2357 | 1:86d25c1c4bd5 | 34 | } |
baba2357 | 1:86d25c1c4bd5 | 35 | |
baba2357 | 3:6ab4e8e3aa02 | 36 | } |
baba2357 | 1:86d25c1c4bd5 | 37 |