the fish that looks like a jet
Dependencies: ADXL345 ADXL345_I2C IMUfilter ITG3200 mbed Servo
Diff: MainController.cpp
- Revision:
- 14:a5389e26a63b
- Parent:
- 13:5ed8fd870723
- Child:
- 15:dc5753a5b83e
diff -r 5ed8fd870723 -r a5389e26a63b MainController.cpp --- a/MainController.cpp Mon Feb 03 21:04:35 2014 +0000 +++ b/MainController.cpp Tue Feb 04 14:23:56 2014 +0000 @@ -28,29 +28,29 @@ timer1.reset(); curTime = 0.0; switched = false; - goofftime = (1/(2*frq)*vol); - amplitude = 1.0; + goofftime = (vol/(2*frq)); + amplitude = vol; } //vol * sqrt(frq)/frqmxsqrt; - if (curTime > 1/(2*frq)) - { - switched = true; - amplitude = -1.0; - } - - if(!switched) - { - if(curTime > goofftime ) - amplitude = 0.0; - } - else - { - if(curTime > (1/(2*frq)+goofftime)) - amplitude = 0.0; - } +// if (curTime > 1/(2*frq) && (switched == false)) +// { +// switched = true; +// amplitude = -1.0; +// } +// +// if(!switched) +// { +// if(curTime > goofftime ) +// amplitude = 0.0; +// } +// else +// { +// if(curTime > (1/(2*frq)+goofftime)) +// amplitude = 0.0; +// } dutyCycle = amplitude * signum(sin( 2.0 * MATH_PI * frq * curTime )); @@ -121,9 +121,9 @@ float MainController::signum(float input) { if (input>0.0) - return 1; + return 1.0; else if (input<0.0) - return -1; + return (-1.0); else - return 0; + return 0.0; } \ No newline at end of file