Gavin Shelton / Mbed 2 deprecated CSC1300_EduBaseV2_Lab3R1

Dependencies:   mbed TTU_CSC1300

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;
+        
+    }
+    
+}