Colton breeding / Mbed 2 deprecated CSC1300_EduBaseV2_Lab0

Dependencies:   mbed TTU_CSC1300

main.cpp

Committer:
coltonbreeding
Date:
2020-11-30
Revision:
1:4d134e02f836
Parent:
0:733cd53309ed

File content as of revision 1:4d134e02f836:

/*
 *     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"
 
AnalogIn pot(P0_11); 
DigitalOut led(LED1); 
 
int main()
{
    float ain;   /* Variable to store the analog input*/
 
    while(TRUE) 
    {
        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);
        }
                 
    }
 
    
}