program for ping pong robot

Dependencies:   mbed

MISC.h

Committer:
pnpako
Date:
2016-06-29
Revision:
0:14b64813c04d

File content as of revision 0:14b64813c04d:


//class for useful functions
class MISC
{

protected:

public:

    //function for easy convertion int -> str
    char* intToString(int x) {
        char tmp[16] = "               ";
        sprintf(tmp, "%d", x);
        return tmp;
    }

    //function for easy convertion float -> str
    char* floatToString(float x) {
        char tmp[20] = "                   ";
        sprintf(tmp, "%f", x);
        return tmp;
    }

    //funtion to cut off too high values
    int ValCut(int val) {
        if(val > 400) {
            return 400;
        } else {
            return val;
        }
    }

};