Gavin Shelton / Mbed 2 deprecated CSC1300_EduBaseV2_Lab3R1

Dependencies:   mbed TTU_CSC1300

main.cpp

Committer:
gavinshelton1
Date:
2020-11-29
Revision:
0:070bf82cd6f3

File content as of revision 0:070bf82cd6f3:

/*
 *     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;
        
    }
    
}