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.
Command.h@4:3fbe2d75f7eb, 2015-11-28 (annotated)
- Committer:
- Xiaofei
- Date:
- Sat Nov 28 19:32:29 2015 +0000
- Revision:
- 4:3fbe2d75f7eb
- Parent:
- 3:97a5a3744481
- Child:
- 7:3dee2b884e1f
c
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Xiaofei | 0:4bc34a5fcc29 | 1 | #pragma once |
| Xiaofei | 0:4bc34a5fcc29 | 2 | #include <cstdint> |
| Xiaofei | 0:4bc34a5fcc29 | 3 | |
| Xiaofei | 0:4bc34a5fcc29 | 4 | class Command |
| Xiaofei | 0:4bc34a5fcc29 | 5 | { |
| Xiaofei | 0:4bc34a5fcc29 | 6 | public: |
| Xiaofei | 1:13c4bf8989d5 | 7 | Command(); |
| Xiaofei | 0:4bc34a5fcc29 | 8 | Command(const Command&); |
| Xiaofei | 0:4bc34a5fcc29 | 9 | virtual ~Command(){} |
| Xiaofei | 0:4bc34a5fcc29 | 10 | virtual void execute() = 0; |
| Xiaofei | 3:97a5a3744481 | 11 | void setSpeed(const std::int8_t& sp=0.5, const std::int8_t& is_negative = 0); |
| Xiaofei | 0:4bc34a5fcc29 | 12 | |
| Xiaofei | 0:4bc34a5fcc29 | 13 | protected: |
| Xiaofei | 3:97a5a3744481 | 14 | float _SPEED; |
| Xiaofei | 3:97a5a3744481 | 15 | bool _IS_NEGATIVE; |
| Xiaofei | 0:4bc34a5fcc29 | 16 | }; |
| Xiaofei | 0:4bc34a5fcc29 | 17 | |
| Xiaofei | 0:4bc34a5fcc29 | 18 | class LedCommand : public Command |
| Xiaofei | 0:4bc34a5fcc29 | 19 | { |
| Xiaofei | 0:4bc34a5fcc29 | 20 | public: |
| Xiaofei | 0:4bc34a5fcc29 | 21 | LedCommand(){} |
| Xiaofei | 0:4bc34a5fcc29 | 22 | virtual void execute(); |
| Xiaofei | 0:4bc34a5fcc29 | 23 | }; |
| Xiaofei | 0:4bc34a5fcc29 | 24 | |
| Xiaofei | 0:4bc34a5fcc29 | 25 | class TurnLeftCommand : public Command |
| Xiaofei | 0:4bc34a5fcc29 | 26 | { |
| Xiaofei | 0:4bc34a5fcc29 | 27 | public: |
| Xiaofei | 0:4bc34a5fcc29 | 28 | TurnLeftCommand(){} |
| Xiaofei | 0:4bc34a5fcc29 | 29 | virtual void execute(); |
| Xiaofei | 0:4bc34a5fcc29 | 30 | }; |
| Xiaofei | 0:4bc34a5fcc29 | 31 | |
| Xiaofei | 0:4bc34a5fcc29 | 32 | class TurnRightCommand : public Command |
| Xiaofei | 0:4bc34a5fcc29 | 33 | { |
| Xiaofei | 0:4bc34a5fcc29 | 34 | public: |
| Xiaofei | 0:4bc34a5fcc29 | 35 | TurnRightCommand(){} |
| Xiaofei | 0:4bc34a5fcc29 | 36 | virtual void execute(); |
| Xiaofei | 0:4bc34a5fcc29 | 37 | }; |
| Xiaofei | 0:4bc34a5fcc29 | 38 | |
| Xiaofei | 0:4bc34a5fcc29 | 39 | class StopCommand : public Command |
| Xiaofei | 0:4bc34a5fcc29 | 40 | { |
| Xiaofei | 0:4bc34a5fcc29 | 41 | public: |
| Xiaofei | 0:4bc34a5fcc29 | 42 | StopCommand(){} |
| Xiaofei | 0:4bc34a5fcc29 | 43 | virtual void execute(); |
| Xiaofei | 1:13c4bf8989d5 | 44 | }; |