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.
sourcefilter/Switch.cpp@0:1ff9e3618717, 2017-03-19 (annotated)
- Committer:
- yyue
- Date:
- Sun Mar 19 22:27:07 2017 +0000
- Revision:
- 0:1ff9e3618717
project
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yyue | 0:1ff9e3618717 | 1 | #include "Switch.h" |
yyue | 0:1ff9e3618717 | 2 | Switch::Switch(PinName pinName) : |
yyue | 0:1ff9e3618717 | 3 | pin(pinName) |
yyue | 0:1ff9e3618717 | 4 | { |
yyue | 0:1ff9e3618717 | 5 | } |
yyue | 0:1ff9e3618717 | 6 | |
yyue | 0:1ff9e3618717 | 7 | bool Switch::stopmotor() |
yyue | 0:1ff9e3618717 | 8 | { |
yyue | 0:1ff9e3618717 | 9 | int pinValue = pin.read(); |
yyue | 0:1ff9e3618717 | 10 | |
yyue | 0:1ff9e3618717 | 11 | if (pinValue == 0) { |
yyue | 0:1ff9e3618717 | 12 | |
yyue | 0:1ff9e3618717 | 13 | return true; |
yyue | 0:1ff9e3618717 | 14 | |
yyue | 0:1ff9e3618717 | 15 | } else { |
yyue | 0:1ff9e3618717 | 16 | return false; |
yyue | 0:1ff9e3618717 | 17 | } |
yyue | 0:1ff9e3618717 | 18 | } |
yyue | 0:1ff9e3618717 | 19 |