Simply creates a servo object from a motor object, to allow the control of the angle.
Dependencies: mbed
Fork of Lab5_Basic by
SLCD.h@12:988fb6ffae63, 2017-11-03 (annotated)
- Committer:
- dogcatfee
- Date:
- Fri Nov 03 19:28:37 2017 -0700
- Revision:
- 12:988fb6ffae63
- Parent:
- 9:e2909d7f36b8
Cleanup, comment, position fixes.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dogcatfee | 9:e2909d7f36b8 | 1 | #include "mbed.h" |
dogcatfee | 9:e2909d7f36b8 | 2 | |
dogcatfee | 9:e2909d7f36b8 | 3 | |
dogcatfee | 9:e2909d7f36b8 | 4 | /* ------ sample usage------ |
dogcatfee | 9:e2909d7f36b8 | 5 | |
dogcatfee | 9:e2909d7f36b8 | 6 | #include "mbed.h" |
dogcatfee | 9:e2909d7f36b8 | 7 | #include "SLCD.h" |
dogcatfee | 9:e2909d7f36b8 | 8 | |
dogcatfee | 9:e2909d7f36b8 | 9 | SLCD slcd; |
dogcatfee | 9:e2909d7f36b8 | 10 | |
dogcatfee | 9:e2909d7f36b8 | 11 | main() |
dogcatfee | 9:e2909d7f36b8 | 12 | { |
dogcatfee | 9:e2909d7f36b8 | 13 | slcd.printf("1234"); // standard printf function, only charaters in ASCII_TO_WF_CODIFICATION_TABLE will display |
dogcatfee | 9:e2909d7f36b8 | 14 | slcd.putc("A"); // prints a single character |
dogcatfee | 9:e2909d7f36b8 | 15 | slcd.Write_Char('A'); // prints a single character |
dogcatfee | 9:e2909d7f36b8 | 16 | slcd.All_Segments(y); // y=1 for ALL segments on, 0 for ALL segments off |
dogcatfee | 9:e2909d7f36b8 | 17 | slcd.DPx(y); // x=DP1 to DP3, y=1 for on 0 for off |
dogcatfee | 9:e2909d7f36b8 | 18 | slcd.Colon(y); // y=1 for on, 0 for off |
dogcatfee | 9:e2909d7f36b8 | 19 | slcd.CharPosition=x; // x=0 to 3, 0 is start position |
dogcatfee | 9:e2909d7f36b8 | 20 | slcd.Home(); // sets next charater to posistion 0 (start) |
dogcatfee | 9:e2909d7f36b8 | 21 | slcd.Contrast (x); // set contrast x=0 - 15, 0 lightest, 15 darkest |
dogcatfee | 9:e2909d7f36b8 | 22 | } |
dogcatfee | 9:e2909d7f36b8 | 23 | */ |
dogcatfee | 9:e2909d7f36b8 | 24 | |
dogcatfee | 9:e2909d7f36b8 | 25 | class SLCD : public Stream { |
dogcatfee | 9:e2909d7f36b8 | 26 | public: |
dogcatfee | 9:e2909d7f36b8 | 27 | SLCD(); |
dogcatfee | 9:e2909d7f36b8 | 28 | |
dogcatfee | 9:e2909d7f36b8 | 29 | void init(); |
dogcatfee | 9:e2909d7f36b8 | 30 | void Write_Char(char lbValue); |
dogcatfee | 9:e2909d7f36b8 | 31 | void Home (void); |
dogcatfee | 9:e2909d7f36b8 | 32 | void Contrast (uint8_t lbContrast); |
dogcatfee | 9:e2909d7f36b8 | 33 | void All_Segments (int); |
dogcatfee | 9:e2909d7f36b8 | 34 | void DP1 (int); |
dogcatfee | 9:e2909d7f36b8 | 35 | void DP2 (int); |
dogcatfee | 9:e2909d7f36b8 | 36 | void DP3 (int); |
dogcatfee | 9:e2909d7f36b8 | 37 | void Colon (int); |
dogcatfee | 9:e2909d7f36b8 | 38 | uint8_t CharPosition; |
dogcatfee | 9:e2909d7f36b8 | 39 | void clear(); |
dogcatfee | 9:e2909d7f36b8 | 40 | |
dogcatfee | 9:e2909d7f36b8 | 41 | virtual int _putc(int c); |
dogcatfee | 9:e2909d7f36b8 | 42 | virtual int _getc() { |
dogcatfee | 9:e2909d7f36b8 | 43 | return 0; |
dogcatfee | 9:e2909d7f36b8 | 44 | } |
dogcatfee | 9:e2909d7f36b8 | 45 | }; |