Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE PinDetect SparkfunAnalogJoystick mbed-rtos mbed SDFileSystem
Fork of 4180FinalLab by
tempModule.h@2:6163865f5ce3, 2014-06-20 (annotated)
- Committer:
- jlind6
- Date:
- Fri Jun 20 15:22:28 2014 +0000
- Revision:
- 2:6163865f5ce3
- Parent:
- 1:839d22d423bd
(Typo) On line 135, changed a vy to a vx.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jlind6 | 0:356124c0bafc | 1 | #include "uLCD_4DGL.h" |
| jlind6 | 0:356124c0bafc | 2 | |
| jlind6 | 1:839d22d423bd | 3 | /* Recommendation: |
| jlind6 | 1:839d22d423bd | 4 | * This class doesn't need to be declared outside the Ball class, |
| jlind6 | 1:839d22d423bd | 5 | * so you can create it inside the Ball class and use it only |
| jlind6 | 1:839d22d423bd | 6 | * in the Ball class. |
| jlind6 | 1:839d22d423bd | 7 | * |
| jlind6 | 1:839d22d423bd | 8 | * If the main function or multiple objects use a piece of hardware |
| jlind6 | 1:839d22d423bd | 9 | * or a class object (like uLCD or mySpeaker), you should pass a |
| jlind6 | 1:839d22d423bd | 10 | * pointer into the object rather than creating the object (either |
| jlind6 | 1:839d22d423bd | 11 | * in the stack or using new). |
| jlind6 | 1:839d22d423bd | 12 | */ |
| jlind6 | 1:839d22d423bd | 13 | |
| jlind6 | 0:356124c0bafc | 14 | class TempModule |
| jlind6 | 0:356124c0bafc | 15 | { |
| jlind6 | 0:356124c0bafc | 16 | public: |
| jlind6 | 0:356124c0bafc | 17 | // Constructors |
| jlind6 | 0:356124c0bafc | 18 | TempModule(PinName pin); |
| jlind6 | 0:356124c0bafc | 19 | TempModule(PinName pin, float vx, float vy); |
| jlind6 | 0:356124c0bafc | 20 | // Reading temperature values |
| jlind6 | 0:356124c0bafc | 21 | float read(); |
| jlind6 | 0:356124c0bafc | 22 | // Set Functions |
| jlind6 | 0:356124c0bafc | 23 | void setBaseVx(float); // This sets the lowest velocity of vx |
| jlind6 | 0:356124c0bafc | 24 | void setBaseVy(float); // This sets the lowest velocity of vy |
| jlind6 | 0:356124c0bafc | 25 | // Get Functions/Member Functions |
| jlind6 | 0:356124c0bafc | 26 | float getVx(); // Calculates a speed based off of the temp |
| jlind6 | 0:356124c0bafc | 27 | float getVy(); |
| jlind6 | 0:356124c0bafc | 28 | float getVx(uLCD_4DGL *); // Same thing as getVx(), except it |
| jlind6 | 0:356124c0bafc | 29 | // also writes the temp to the screen. |
| jlind6 | 0:356124c0bafc | 30 | |
| jlind6 | 0:356124c0bafc | 31 | private: |
| jlind6 | 0:356124c0bafc | 32 | // Data members are suggestions, feel free to add/remove |
| jlind6 | 0:356124c0bafc | 33 | AnalogIn _sensor; |
| jlind6 | 0:356124c0bafc | 34 | float roomTemp; |
| jlind6 | 0:356124c0bafc | 35 | float holdTemp; |
| jlind6 | 0:356124c0bafc | 36 | float basevx; |
| jlind6 | 0:356124c0bafc | 37 | float basevy; |
| jlind6 | 0:356124c0bafc | 38 | int counter; |
| jlind6 | 0:356124c0bafc | 39 | }; |
| jlind6 | 0:356124c0bafc | 40 | |
| jlind6 | 0:356124c0bafc | 41 | TempModule::TempModule (PinName pin) : _sensor(pin) |
| jlind6 | 0:356124c0bafc | 42 | { |
| jlind6 | 0:356124c0bafc | 43 | // Constructor code goes here |
| jlind6 | 0:356124c0bafc | 44 | // you can ignore initializing _sensor, we've already done that |
| jlind6 | 0:356124c0bafc | 45 | } |
| jlind6 | 0:356124c0bafc | 46 | |
| jlind6 | 0:356124c0bafc | 47 | TempModule::TempModule (PinName pin, float vx, float vy) : _sensor(pin) |
| jlind6 | 0:356124c0bafc | 48 | { |
| jlind6 | 0:356124c0bafc | 49 | // Constructor code goes here |
| jlind6 | 0:356124c0bafc | 50 | // you can ignore initializing _sensor, we've already done that |
| jlind6 | 0:356124c0bafc | 51 | } |
