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@9:fd45093bcf20, 2020-12-02 (annotated)
- Committer:
- javiervicente
- Date:
- Wed Dec 02 15:52:45 2020 +0000
- Revision:
- 9:fd45093bcf20
- Parent:
- 8:5b66f431c487
- Child:
- 10:1d0fc62de664
He cambiado el delay
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| javiervicente | 8:5b66f431c487 | 1 | #include "mbed.h" |
| javiervicente | 8:5b66f431c487 | 2 | #include "hcsr04.h" |
| javiervicente | 8:5b66f431c487 | 3 | |
| javiervicente | 8:5b66f431c487 | 4 | Serial pc(USBTX, USBRX); // tx, rx |
| javiervicente | 8:5b66f431c487 | 5 | |
| javiervicente | 9:fd45093bcf20 | 6 | HCSR04 usensor(D7,D8); //(PinName TrigPin,PinName EchoPin): |
| javiervicente | 8:5b66f431c487 | 7 | int main() |
| javiervicente | 8:5b66f431c487 | 8 | { |
| javiervicente | 8:5b66f431c487 | 9 | unsigned int dist; |
| javiervicente | 8:5b66f431c487 | 10 | pc.baud(115200); |
| javiervicente | 8:5b66f431c487 | 11 | while(1) { |
| javiervicente | 8:5b66f431c487 | 12 | usensor.start(); |
| javiervicente | 9:fd45093bcf20 | 13 | dist=usensor.get_dist_cm(); |
| javiervicente | 9:fd45093bcf20 | 14 | pc.printf("Distance =%d\n",dist); |
| javiervicente | 9:fd45093bcf20 | 15 | wait_ms(2000); |
| javiervicente | 8:5b66f431c487 | 16 | |
| javiervicente | 8:5b66f431c487 | 17 | } |
| javiervicente | 8:5b66f431c487 | 18 | } |