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: AQM0802A HMC6352 L6470_lib PID mbed
Fork of CatPot_Main_ver1 by
Revision 5:3d68334aab20, committed 2015-01-08
- Comitter:
- ryuna
- Date:
- Thu Jan 08 05:08:34 2015 +0000
- Parent:
- 4:8444360f08e2
- Child:
- 6:c2c31bc971ad
- Commit message:
- add
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Dec 29 07:24:37 2014 +0000
+++ b/main.cpp Thu Jan 08 05:08:34 2015 +0000
@@ -69,8 +69,9 @@
#define Debug2 0x08
#define StartS 0x10
-#define READ_IR 0x01 //送る物指定
-#define READ_PING 0x02
+#define READ_IR 0x01 //送る物指定
+#define READ_PING 0x02
+
@@ -225,21 +226,23 @@
void PingReceiveRL(char ping[]){//ping[0]==Right,ping[1]==Left
- char pingdata[1] = {READ_PING};
+ char ReadSelect[1] = {READ_PING};
bool val;
- val = Sensor.write(ADDRESS_R|0,pingdata , 1);
+ val = Sensor.write(ADDRESS_R|0, ReadSelect , 1);
Led[2] = val;
val = Sensor.read(ADDRESS_R|1, ping, 2);
Led[2] = !val;
-
-
}
+
+
+
+
void rotate(unsigned int times, bool dir){
/*
*回転速度,回転方向,回転角度等設定変更ののち回転.
- *
+ * this is 使わなそうである、
*/
@@ -397,7 +400,37 @@
void ControlRobo6(int *CompassDef)//BackRight
{}
void ControlRobo7(int *CompassDef)//Back
-{}
+{
+ /*****
+ * this function is drawing a semicircle.
+ * semicircle manipulated ir_data&ping_data.
+ *
+ * 変数名は後から変えるためにわかりやすい名前にしておく
+ **/
+ uint8_t ir_num;
+ uint8_t pingl,pingr;
+
+ /*
+ ir(1位,2位,必要なら距離も)と超音波のデータを取得
+ */
+ if(ir_num==7){//一致しているかどうか念のため
+ return ;
+ }
+ if(pingr<pingl){//本当ならば壁と垂直かどうか、確認すべき。コンパスや超音波の合計を見れば可能
+ /*軌道の計算、楕円の半分見たいな感じの軌道がベスト*/
+ /*半円なのであらかじめステッピングを回転させる必要がある*/
+ /*モーター設定*/
+ /*ステッピング設定*/
+ return;
+ }
+ /*軌道の計算、楕円の半分見たいな感じの軌道がベスト*/
+ /*半円なのであらかじめステッピングを回転させる必要がある*/
+ /*モーター設定*/
+ /*ステッピング設定*/
+ return;
+
+
+ }
void ControlRobo8(int *CompassDef)//BackLeft
{}
void ControlRobo9(int *CompassDef)//LeftBack
@@ -407,7 +440,12 @@
void ControlRobo11(int *CompassDef)//LeftFront
{}
void GoHome(int *CompassDef)//Ball is not found.
-{}
+{
+
+
+
+
+}
uint8_t SwRead(){
@@ -466,7 +504,7 @@
*/
while(1){
Compass = ((hmc6352.sample() / 10) + 540 - *compass_def) % 360;
- if(Cmpass == 3) break;//前を向いたら抜ける。
+ if(Compass == 3) break;//前を向いたら抜ける。
}
Lcd.cls();
@@ -509,11 +547,20 @@
continue;
}
if(State == Debug1){
- /* debug command free */
+ /* debug command free
+ *
+ *display out to selected 3 menus. compass, ir, ping, line,etc...
+ *
+ **/
}
if(State == Debug2){
- /* debug command free */
+ /* debug command free
+ *
+ * decide movement of the beginning.
+ *
+ *
+ **/
}
if(State == StartS){
