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
Diff: main.cpp
- Revision:
- 0:070bf82cd6f3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Nov 29 20:53:38 2020 +0000
@@ -0,0 +1,53 @@
+/*
+ * Lab #: 3
+ * Lab Title: Hardware Lab 3
+ * Author(s): Gavin Shelton
+ * Date: 11-29-2020
+ * Purpose: Using the Potentiometer and Utilizing Conditional Statments
+ */
+
+#include "mbed.h"
+#include "TTU_CSC1300.h"
+
+//FUNCTION PROTOTYPES GO HERE
+
+TextLCD lcd(TextLCD::LCD_CURSOR_ON_BLINKING_ON);
+
+int main()
+{
+ //this while(TRUE) loop keeps the program running
+
+ float f_value = pot.read();
+ bool sw5_pressed = sw5;
+ bool sw4_pressed = sw4;
+
+ f_value = (f_value * 25) + 20;
+
+
+ if ((sw5_pressed == TRUE) && (f_value > 35)) {
+
+ led0 = TRUE;
+ speaker = TRUE;
+ wait_ms(f_value);
+ led0 = FALSE;
+ speaker = FALSE;
+
+ }
+ else if (sw4_pressed == TRUE) {
+
+ led0 = TRUE;
+ speaker = TRUE;
+ wait_ms(f_value);
+ led0 = FALSE;
+ speaker = FALSE;
+
+ }
+ else {
+
+ speaker = TRUE;
+ wait_ms(f_value);
+ speaker = FALSE;
+
+ }
+
+}