Renjian Hao
Dependencies: L3G4200D L3GD20 LSM303DLHC LSM303DLM PwmIn Servo mbed
Fork of Fish_2014Fall by
Diff: main.cpp
- Revision:
- 3:caa0d4fd1d1d
- Parent:
- 2:d5dc0db74d84
- Child:
- 4:c93e1ecd3359
--- a/main.cpp Mon Jun 29 17:30:28 2015 +0000 +++ b/main.cpp Wed Jul 01 18:45:22 2015 +0000 @@ -43,7 +43,7 @@ float Tailbias=0.0; float AngleTail_stand_bias=0.0; -long int FA=1000000,FB=1000000,FE=40,CountA=0,CountB=0,CountE=0;; +long int FA=1000000,FB=1000000,FE=10,CountA=0,CountB=0,CountE=0;; int flag; int x,y; // Image coordinate @@ -139,17 +139,17 @@ PWMD.pulsewidth(period_pwm*AngleRight);//0.08 mid 0.04 forward } -/* + void moveE() { if(directionE) { - AngleTail=0.09+Tailbias; + AngleTail=0.08+Tailbias; directionE=!directionE; } else { - AngleTail=0.06+Tailbias; + AngleTail=0.07+Tailbias; directionE=!directionE; } @@ -158,8 +158,9 @@ STBY=1; //disable standby PWME.pulsewidth(period_pwm*AngleTail);//0.08 mid 0.04 forward } -*/ + +/* void moveE_stand() { @@ -170,6 +171,7 @@ STBY=1; //disable standby PWME.pulsewidth(period_pwm*AngleTail);//0.08 mid 0.04 forward } +*/ void stop() { //enable standby @@ -245,7 +247,7 @@ speedA=0.02; Tailbias=0.015; AngleTail_stand_bias=0.015; - moveE_stand(); + //moveE_stand(); } else if(y<190&&y>100) @@ -256,7 +258,7 @@ speedB=0.02; Tailbias=-0.015; AngleTail_stand_bias=-0.015; - moveE_stand(); + //moveE_stand(); } else { @@ -268,7 +270,7 @@ speedB=0.2; Tailbias=0; AngleTail_stand_bias=0.0; - moveE_stand(); + //moveE_stand(); } if(CountA>=FA) { @@ -290,7 +292,7 @@ CountB++; } - /* + if(CountE>=FE) { moveE(); @@ -301,7 +303,7 @@ CountE++; } - */ //6/29/2015 Tail + //6/29/2015 Tail if(x<300&&x>100) { //AngleLeft=-0.0005*x+0.18;