My modifications/additions to the code

Dependencies:   ADXL345 ADXL345_I2C IMUfilter ITG3200 Servo fishgait mbed-rtos mbed pixy_cam

Fork of robotic_fish_ver_4_8 by jetfishteam

motor_controller.h

Committer:
sandwich
Date:
2014-01-30
Revision:
7:e005cfaff8d1
Parent:
6:a4d6f3e4bf28
Child:
8:0574a5db1fc4

File content as of revision 7:e005cfaff8d1:

#pragma once
#include "mbed.h"
#define MATH_PI 3.14159265359
#define FREQ_MIN 0.5  //Hz
#define FREQ_MAX 3  //Hz

float sigm(float input);

class PololuMController
{
    private:
    PwmOut* pwm;
    DigitalOut* outA;
    DigitalOut* outB;
    float timestamp;
    public:
    PololuMController();
    PololuMController(PinName pwmport, PinName A, PinName B);
    ~PololuMController();
    void setspeed(float speed);         //0 to 1
    void setpolarspeed(float speed);    //-1 to 1
    void reverse();                     //only works on non-polar speed
    void drive_sinusoidal(float currentTime, float dutyCycle, float frequency);
    void drive_rectangular(float currentTime, float amplitude, float frequency);
};