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@0:b0571bc84ca0, 2020-11-18 (annotated)
- Committer:
- corbindenham
- Date:
- Wed Nov 18 05:46:05 2020 +0000
- Revision:
- 0:b0571bc84ca0
- Child:
- 1:e68c879b0651
code for led and ticking sound lab
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
corbindenham | 0:b0571bc84ca0 | 1 | #include "mbed.h" |
corbindenham | 0:b0571bc84ca0 | 2 | |
corbindenham | 0:b0571bc84ca0 | 3 | /* |
corbindenham | 0:b0571bc84ca0 | 4 | * Lab #: 1 |
corbindenham | 0:b0571bc84ca0 | 5 | * Lab Title: Hardware Lab 1 |
corbindenham | 0:b0571bc84ca0 | 6 | * Author(s): Corbin Denham |
corbindenham | 0:b0571bc84ca0 | 7 | * Date: 11/4/20 |
corbindenham | 0:b0571bc84ca0 | 8 | * Purpose: To learn how to code switches and LEDs |
corbindenham | 0:b0571bc84ca0 | 9 | */ |
corbindenham | 0:b0571bc84ca0 | 10 | |
corbindenham | 0:b0571bc84ca0 | 11 | #include "mbed.h" |
corbindenham | 0:b0571bc84ca0 | 12 | #include "TTU_CSC1300.h" |
corbindenham | 0:b0571bc84ca0 | 13 | |
corbindenham | 0:b0571bc84ca0 | 14 | //FUNCTION PROTOTYPES GO HERE |
corbindenham | 0:b0571bc84ca0 | 15 | TextLCD lcd(TextLCD::LCD_CURSOR_ON_BLINKING_ON); |
corbindenham | 0:b0571bc84ca0 | 16 | |
corbindenham | 0:b0571bc84ca0 | 17 | int main() |
corbindenham | 0:b0571bc84ca0 | 18 | { |
corbindenham | 0:b0571bc84ca0 | 19 | //this while(TRUE) loop keeps the program running |
corbindenham | 0:b0571bc84ca0 | 20 | while(TRUE) |
corbindenham | 0:b0571bc84ca0 | 21 | { |
corbindenham | 0:b0571bc84ca0 | 22 | float f_value = pot.read(); |
corbindenham | 0:b0571bc84ca0 | 23 | |
corbindenham | 0:b0571bc84ca0 | 24 | f_value = f_value * 25 + 20; |
corbindenham | 0:b0571bc84ca0 | 25 | speaker = TRUE; |
corbindenham | 0:b0571bc84ca0 | 26 | led0 = TRUE; |
corbindenham | 0:b0571bc84ca0 | 27 | wait_ms(10); |
corbindenham | 0:b0571bc84ca0 | 28 | speaker = FALSE; |
corbindenham | 0:b0571bc84ca0 | 29 | led0 = FALSE; |
corbindenham | 0:b0571bc84ca0 | 30 | wait_ms(f_value); |
corbindenham | 0:b0571bc84ca0 | 31 | } |
corbindenham | 0:b0571bc84ca0 | 32 | |
corbindenham | 0:b0571bc84ca0 | 33 | } |