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:7913048819b0, 2021-04-21 (annotated)
- Committer:
- iashelton
- Date:
- Wed Apr 21 04:34:08 2021 +0000
- Revision:
- 0:7913048819b0
Final lab 9;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
iashelton | 0:7913048819b0 | 1 | /* |
iashelton | 0:7913048819b0 | 2 | * Lab #:9 |
iashelton | 0:7913048819b0 | 3 | * Lab Title:loops |
iashelton | 0:7913048819b0 | 4 | * Author(s):Ian Shelton |
iashelton | 0:7913048819b0 | 5 | * Date: 04/20/21 |
iashelton | 0:7913048819b0 | 6 | * Purpose: counts in bianary to 7 then loops |
iashelton | 0:7913048819b0 | 7 | */ |
iashelton | 0:7913048819b0 | 8 | |
iashelton | 0:7913048819b0 | 9 | #include "mbed.h" |
iashelton | 0:7913048819b0 | 10 | #include "TTU_CSC1300.h" |
iashelton | 0:7913048819b0 | 11 | |
iashelton | 0:7913048819b0 | 12 | //FUNCTION PROTOTYPES GO HERE |
iashelton | 0:7913048819b0 | 13 | BusOut all_leds(LED0_PIN, LED1_PIN, LED2_PIN); //can write to all LEDs at once, 0-7 represents combination of on LEDs |
iashelton | 0:7913048819b0 | 14 | TextLCD lcd(TextLCD::LCD_CURSOR_ON_BLINKING_ON); |
iashelton | 0:7913048819b0 | 15 | |
iashelton | 0:7913048819b0 | 16 | int main() |
iashelton | 0:7913048819b0 | 17 | { |
iashelton | 0:7913048819b0 | 18 | int i(0); |
iashelton | 0:7913048819b0 | 19 | //this while(TRUE) loop keeps the program running |
iashelton | 0:7913048819b0 | 20 | while(TRUE) |
iashelton | 0:7913048819b0 | 21 | { |
iashelton | 0:7913048819b0 | 22 | //WRITE SOLUTION HERE |
iashelton | 0:7913048819b0 | 23 | while(sw5!=1) |
iashelton | 0:7913048819b0 | 24 | { |
iashelton | 0:7913048819b0 | 25 | i++; |
iashelton | 0:7913048819b0 | 26 | all_leds=i; |
iashelton | 0:7913048819b0 | 27 | if(i==7) |
iashelton | 0:7913048819b0 | 28 | { |
iashelton | 0:7913048819b0 | 29 | i=0; |
iashelton | 0:7913048819b0 | 30 | } |
iashelton | 0:7913048819b0 | 31 | wait_ms(1000); |
iashelton | 0:7913048819b0 | 32 | } |
iashelton | 0:7913048819b0 | 33 | led1=TRUE; |
iashelton | 0:7913048819b0 | 34 | led0=TRUE; |
iashelton | 0:7913048819b0 | 35 | led2=TRUE; |
iashelton | 0:7913048819b0 | 36 | wait_ms(1000); |
iashelton | 0:7913048819b0 | 37 | led1=FALSE; |
iashelton | 0:7913048819b0 | 38 | led0=FALSE; |
iashelton | 0:7913048819b0 | 39 | led2=FALSE; |
iashelton | 0:7913048819b0 | 40 | wait_ms(1000); |
iashelton | 0:7913048819b0 | 41 | |
iashelton | 0:7913048819b0 | 42 | |
iashelton | 0:7913048819b0 | 43 | |
iashelton | 0:7913048819b0 | 44 | |
iashelton | 0:7913048819b0 | 45 | } |
iashelton | 0:7913048819b0 | 46 | } |
iashelton | 0:7913048819b0 | 47 |