![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Two player imu pong
Dependencies: 4DGL-uLCD-SE IMUfilter LSM9DS0 PinDetect mbed
tempModule.h@0:941225f01ccc, 2015-10-22 (annotated)
- Committer:
- rrr93
- Date:
- Thu Oct 22 16:50:22 2015 +0000
- Revision:
- 0:941225f01ccc
qewrt
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rrr93 | 0:941225f01ccc | 1 | #include "uLCD_4DGL.h" |
rrr93 | 0:941225f01ccc | 2 | |
rrr93 | 0:941225f01ccc | 3 | /* Recommendation: |
rrr93 | 0:941225f01ccc | 4 | * This class doesn't need to be declared outside the Ball class, |
rrr93 | 0:941225f01ccc | 5 | * so you can create it inside the Ball class and use it only |
rrr93 | 0:941225f01ccc | 6 | * in the Ball class. |
rrr93 | 0:941225f01ccc | 7 | * |
rrr93 | 0:941225f01ccc | 8 | * If the main function or multiple objects use a piece of hardware |
rrr93 | 0:941225f01ccc | 9 | * or a class object (like uLCD or mySpeaker), you should pass a |
rrr93 | 0:941225f01ccc | 10 | * pointer into the object rather than creating the object (either |
rrr93 | 0:941225f01ccc | 11 | * in the stack or using new). |
rrr93 | 0:941225f01ccc | 12 | */ |
rrr93 | 0:941225f01ccc | 13 | |
rrr93 | 0:941225f01ccc | 14 | class TempModule |
rrr93 | 0:941225f01ccc | 15 | { |
rrr93 | 0:941225f01ccc | 16 | public: |
rrr93 | 0:941225f01ccc | 17 | // Constructors |
rrr93 | 0:941225f01ccc | 18 | TempModule(PinName pin); |
rrr93 | 0:941225f01ccc | 19 | TempModule(PinName pin, float vx, float vy); |
rrr93 | 0:941225f01ccc | 20 | // Reading temperature values |
rrr93 | 0:941225f01ccc | 21 | float read(); |
rrr93 | 0:941225f01ccc | 22 | // Set Functions |
rrr93 | 0:941225f01ccc | 23 | void setBaseVx(float); // This sets the lowest velocity of vx |
rrr93 | 0:941225f01ccc | 24 | void setBaseVy(float); // This sets the lowest velocity of vy |
rrr93 | 0:941225f01ccc | 25 | // Get Functions/Member Functions |
rrr93 | 0:941225f01ccc | 26 | float getVx(); // Calculates a speed based off of the temp |
rrr93 | 0:941225f01ccc | 27 | float getVy(); |
rrr93 | 0:941225f01ccc | 28 | float getVx(uLCD_4DGL *); // Same thing as getVx(), except it |
rrr93 | 0:941225f01ccc | 29 | // also writes the temp to the screen. |
rrr93 | 0:941225f01ccc | 30 | |
rrr93 | 0:941225f01ccc | 31 | private: |
rrr93 | 0:941225f01ccc | 32 | // Data members are suggestions, feel free to add/remove |
rrr93 | 0:941225f01ccc | 33 | AnalogIn _sensor; //_pin |
rrr93 | 0:941225f01ccc | 34 | float roomTemp; |
rrr93 | 0:941225f01ccc | 35 | float holdTemp; |
rrr93 | 0:941225f01ccc | 36 | float basevx; |
rrr93 | 0:941225f01ccc | 37 | float basevy; |
rrr93 | 0:941225f01ccc | 38 | int counter; |
rrr93 | 0:941225f01ccc | 39 | }; |
rrr93 | 0:941225f01ccc | 40 | |
rrr93 | 0:941225f01ccc | 41 |