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.
main.cpp@0:c7664aa400c6, 2022-05-20 (annotated)
- Committer:
- zatharv
- Date:
- Fri May 20 08:56:18 2022 +0000
- Revision:
- 0:c7664aa400c6
.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
zatharv | 0:c7664aa400c6 | 1 | #include "mbed.h" |
zatharv | 0:c7664aa400c6 | 2 | #include "TSISensor.h" |
zatharv | 0:c7664aa400c6 | 3 | |
zatharv | 0:c7664aa400c6 | 4 | PwmOut red(LED1); |
zatharv | 0:c7664aa400c6 | 5 | |
zatharv | 0:c7664aa400c6 | 6 | int main() { |
zatharv | 0:c7664aa400c6 | 7 | TSISensor tsi; |
zatharv | 0:c7664aa400c6 | 8 | while(1) { |
zatharv | 0:c7664aa400c6 | 9 | if (tsi.readPercentage()) |
zatharv | 0:c7664aa400c6 | 10 | { |
zatharv | 0:c7664aa400c6 | 11 | red = 0 + tsi.readDistance()/40.0; |
zatharv | 0:c7664aa400c6 | 12 | wait(0.1); |
zatharv | 0:c7664aa400c6 | 13 | } |
zatharv | 0:c7664aa400c6 | 14 | else |
zatharv | 0:c7664aa400c6 | 15 | { |
zatharv | 0:c7664aa400c6 | 16 | red = 1; |
zatharv | 0:c7664aa400c6 | 17 | } |
zatharv | 0:c7664aa400c6 | 18 | } |
zatharv | 0:c7664aa400c6 | 19 | } |