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
Revision 1:4d134e02f836, committed 2020-11-30
- Comitter:
- coltonbreeding
- Date:
- Mon Nov 30 23:31:33 2020 +0000
- Parent:
- 0:733cd53309ed
- Commit message:
- LED will blink
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Nov 04 04:32:20 2020 +0000
+++ b/main.cpp Mon Nov 30 23:31:33 2020 +0000
@@ -1,25 +1,52 @@
/*
- * Lab #:
- * Lab Title:
- * Author(s):
- * Date:
- * Purpose:
+ * Lab #: 3
+ * Lab Title: Hardware 3
+ * Author(s): Colton Breeding
+ * Date: 11/18/20
+ * Purpose: Turn on the speaker and LED in an if then statment
*/
-
+
#include "mbed.h"
#include "TTU_CSC1300.h"
-
-//FUNCTION PROTOTYPES GO HERE
-TextLCD lcd(TextLCD::LCD_CURSOR_ON_BLINKING_ON);
+
+AnalogIn pot(P0_11);
+DigitalOut led(LED1);
+
int main()
{
- //this while(TRUE) loop keeps the program running
- while(TRUE)
+ float ain; /* Variable to store the analog input*/
+
+ while(TRUE)
{
- //WRITE SOLUTION HERE
- //blinks "Hello, World!" every other second
-lcd.printf("Hello, World!");
-wait_ms(1000);
-lcd.cls();
-wait_ms(1000); }
+ ain = pot.read();
+ (ain*25)+20;
+ if(SW5 = TRUE && ain > 35)
+ {
+ LED0 = TRUE
+ speaker = TRUE;
+ wait_ms(10);
+ LED0 = FALSE
+ speaker = FALSE;
+ wait_ms(ain);
+ }
+ else if(SW4 = TRUE)
+ {
+ LED0 = TRUE
+ speaker = TRUE;
+ wait_ms(10);
+ LED0 = FALSE
+ speaker = FALSE;
+ wait_ms(ain);
+ }
+ else
+ {
+ speaker = TRUE;
+ wait_ms(10);
+ speaker = FALSE;
+ wait_ms(ain);
+ }
+
+ }
+
+
}
\ No newline at end of file