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.
Dependencies: mbed TTU_CSC1300
main.cpp@1:52c4dc3237b5, 2020-11-12 (annotated)
- Committer:
- jzlimbaugh
- Date:
- Thu Nov 12 01:28:20 2020 +0000
- Revision:
- 1:52c4dc3237b5
- Parent:
- 0:268a8b67fdbe
Turn on the led and buzzer then wait to turn them off and wait according to the resistance of the potentiometer.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jzlimbaugh | 0:268a8b67fdbe | 1 | /* |
| jzlimbaugh | 0:268a8b67fdbe | 2 | * Lab #:2 |
| jzlimbaugh | 0:268a8b67fdbe | 3 | * Lab Title:Reading and Processing Analog Inputs |
| jzlimbaugh | 0:268a8b67fdbe | 4 | * Author(s):Jerrald Limbaugh |
| jzlimbaugh | 0:268a8b67fdbe | 5 | * Date:November 11th |
| jzlimbaugh | 1:52c4dc3237b5 | 6 | * Purpose:Turn on Led and Buzzer then wait turn them off then wail according to the resistance of the Potentiometer. |
| jzlimbaugh | 0:268a8b67fdbe | 7 | */ |
| jzlimbaugh | 0:268a8b67fdbe | 8 | |
| jzlimbaugh | 0:268a8b67fdbe | 9 | #include "mbed.h" |
| jzlimbaugh | 0:268a8b67fdbe | 10 | #include "TTU_CSC1300.h" |
| jzlimbaugh | 0:268a8b67fdbe | 11 | |
| jzlimbaugh | 0:268a8b67fdbe | 12 | //FUNCTION PROTOTYPES GO HERE |
| jzlimbaugh | 0:268a8b67fdbe | 13 | |
| jzlimbaugh | 0:268a8b67fdbe | 14 | int main() |
| jzlimbaugh | 0:268a8b67fdbe | 15 | |
| jzlimbaugh | 0:268a8b67fdbe | 16 | { |
| jzlimbaugh | 0:268a8b67fdbe | 17 | while(TRUE) |
| jzlimbaugh | 0:268a8b67fdbe | 18 | { |
| jzlimbaugh | 0:268a8b67fdbe | 19 | float f_value = pot.read(); |
| jzlimbaugh | 0:268a8b67fdbe | 20 | float wait = f_value * 25 + 20; |
| jzlimbaugh | 0:268a8b67fdbe | 21 | led0 = TRUE; |
| jzlimbaugh | 0:268a8b67fdbe | 22 | speaker = TRUE; |
| jzlimbaugh | 0:268a8b67fdbe | 23 | wait_ms(10); |
| jzlimbaugh | 0:268a8b67fdbe | 24 | speaker = FALSE; |
| jzlimbaugh | 0:268a8b67fdbe | 25 | led0 = FALSE; |
| jzlimbaugh | 0:268a8b67fdbe | 26 | wait_ms(wait); |
| jzlimbaugh | 0:268a8b67fdbe | 27 | led0 = TRUE; |
| jzlimbaugh | 0:268a8b67fdbe | 28 | speaker = TRUE; |
| jzlimbaugh | 0:268a8b67fdbe | 29 | } |
| jzlimbaugh | 0:268a8b67fdbe | 30 | } |